AI-NOTES-UNIT-II
AI-NOTES-UNIT-II
Artificial Intelligence (AI) is the ability for an artificial machine to act intelligently. Logic
Programming is a method that computer scientists are using to try to allow machines to reason
because it is useful for knowledge representation. In logic programming, logic is used to
represent knowledge and inference is used to manipulate it.
Propositional logic (PL) is the simplest form of logic where all the statements are made by
propositions. A proposition is a declarative statement which is either true or false. It is a
technique of knowledge representation in logical and mathematical form.
Example:
1. a) It is Sunday.
2. b) The Sun rises from West (False proposition)
3. c) 3+3= 7(False proposition)
4. d) 5 is a prime number.
The syntax of propositional logic defines the allowable sentences for the knowledge
representation. There are two types of Propositions:
1.Atomic Propositions
2.Compound propositions
Example:
Logical Connectives:
Logical connectives are used to connect two simpler propositions or representing a sentence
logically. We can create compound propositions with the help of logical connectives. There are
mainly five connectives, which are given as follows:
Truth Table:
In propositional logic, we need to know the truth values of propositions in all possible scenarios.
We can combine all the possible combination with logical connectives, and the representation of
these combinations in a tabular format is called Truth table. Following are the truth table for all
logical connectives:
Truth table with three propositions:
We can build a proposition composing three propositions P, Q, and R. This truth table is made-
up of 8n Tuples as we have taken three proposition symbols.
Natural Deduction:
ND techniques were used as early as people did reasoning, it is unquestionable that the exact
formulation of ND and the justification of its correctness was postponed until the 20th century.
Applications
There are three main fields of application of ND systems: practical, theoretical and
philosophical.
Resolution is one kind of proof technique that works this way - (i) select two clauses that
contain conflicting terms (ii) combine those two clauses and (iii) cancel out the conflicting
terms.
For example we have following statements,
(1) If it is a pleasant day you will do strawberry picking
(2) If you are doing strawberry picking you are happy.
Let's see an example to understand how Resolution and Refutation work. In below
example, Part(I) represents the English meanings for the clauses, Part(II) represents the
propositional logic statements for given english sentences, Part(III) represents the Conjunctive
Normal Form (CNF) of Part(II) and Part(IV) shows some other statements we want to prove
using Refutation proof method.
(6) It is raining
(7) It is sunny
Part(II) : Propositional Statements
(5) warm
(6) raining
(7) sunny
(5) (warm) ∧
(6) (raining) ∧
(7) (sunny)
Predicate Logic deals with predicates, which are propositions, consist of variables.\
Quantifier:
The variable of predicates is quantified by quantifiers. There are two types of quantifier in predicate
logic - Existential Quantifier and Universal Quantifier.
Existential Quantifier:
If p(x) is a proposition over the universe U. Then it is denoted as ∃x p(x) and read as "There exists at
least one value in the universe of variable x such that p(x) is true. The quantifier ∃ is called the
existential quantifier.
There are several ways to write a proposition, with an existential quantifier, i.e.,
(∃x∈A)p(x) or ∃x∈A such that p (x) or (∃x)p(x) or p(x) is true for some x ∈A.
Universal Quantifier:
If p(x) is a proposition over the universe U. Then it is denoted as ∀x,p(x) and read as "For every
x∈U,p(x) is true." The quantifier ∀ is called the Universal Quantifier.
The two rules for negation of quantified proposition are as follows. These are also called DeMorgan's
Law.
Example: Negate each of the following propositions:
2. (∃x∈U) (x+6=25)
3. ~( ∃ x p(x)∨∀ y q(y)
The proposition which contains both universal and existential quantifiers, the order of those quantifiers
can't be exchanged without altering the meaning of the proposition, e.g., the proposition ∃x ∀ y p(x,y)
means "There exists some x such that p (x, y) is true for every y."
Example: Write the negation for each of the following. Determine whether the resulting statement is
true or false. Assume U = R.
1.∀ x ∃ m(x2<m)
2. ∃ m∀ x(x2<m)
Sol: Negation of ∃ m ∀ x (x2<m) is ∀ m∃x (x2≥m). The meaning of ∀ m∃x (x2≥m) is that for every m,
there exists for some x such that x2≥m. The statement is true as for every m, there exists for some
greater x such that x2.
Topic: Difference between Procedural and Declarative
Knowledge
Procedural Knowledge:
Procedural Knowledge also known as Interpretive knowledge, is the type of knowledge in which
it clarifies how a particular thing can be accomplished. It is not so popular because it is generally
not used.
It emphasize how to do something to solve a given problem.
Let’s see it with an example:
var a=[1, 2, 3, 4, 5];
var b=[];
for(var i=0;i<a.length;i++)
b.push(a[i]);
console.log(b);
Output is:
[1, 2, 3, 4, 5]
Declarative Knowledge:
Declarative Knowledge also known as Descriptive knowledge, is the type of knowledge which
tells the basic knowledge about something and it is more popular than Procedural Knowledge.
It emphasize what to do something to solve a given problem.
Let’s see it with an example:
var a=[1, 2, 3, 4, 5];
var b=a.map(function(number)
return number*1});
console.log(b);
Output is:
[1, 2, 3, 4, 5]
In both example we can see that the output of a given problem is same because the only
difference in that two methods to achieve the output or solution of problem.
In Procedural Knowledge
debugging and validation is not In Declarative Knowledge
6. easy. debugging and validation is easy.
follow conclusions
The solution of a problem generally includes the initial data and facts in order to arrive at the
solution. These unknown facts and information is used to deduce the result. For example, while
diagnosing a patient the doctor first check the symptoms and medical condition of the body such
as temperature, blood pressure, pulse, eye colour, blood, etcetera. After that, the patient
symptoms are analysed and compared against the predetermined symptoms. Then the doctor is
able to provide the medicines according to the symptoms of the patient. So, when a solution
employs this manner of reasoning, it is known as forward reasoning.
The inference engine explores the knowledge base with the provided information for constraints
whose precedence matches the given current state.
In the first step, the system is given one or more than one constraints.
Then the rules are searched in the knowledge base for each constraint. The rules that fulfil
the condition are selected.
Now each rule is able to produce new conditions from the conclusion of the invoked one.
As a result, THEN part is again included in the existing one.
The added conditions are processed again by repeating step 2. The process will end if there
is no new conditions exist.
The backward reasoning is inverse of forward reasoning in which goal is analysed in order to
deduce the rules, initial facts and data. We can understand the concept by the similar example
given in the above definition, where the doctor is trying to diagnose the patient with the help of
the inceptive data such as symptoms. However, in this case, the patient is experiencing a problem
in his body, on the basis of which the doctor is going to prove the symptoms. This kind of
reasoning comes under backward reasoning.
In this type of reasoning, the system chooses a goal state and reasons in the backward direction.
Now, let’s understand how does it happens and what steps are followed.
Firstly, the goal state and the rules are selected where the goal state reside in the THEN part
as the conclusion.
From the IF part of the selected rule the subgoals are made to be satisfied for the goal state
to be true.
Set initial conditions important to satisfy all the subgoals.
Verify whether the provided initial state matches with the established states. If it fulfils the
condition then the goal is the solution otherwise other goal state is selected.
1. The forward reasoning is data-driven approach while backward reasoning is a goal driven.
2. The process starts with new data and facts in the forward reasoning. Conversely, backward
reasoning begins with the results.
3. Forward reasoning aims to determine the result followed by some sequences. On the other
hand, backward reasoning emphasis on the acts that support the conclusion.
5. The flow of the forward reasoning is from the antecedent to consequent while backward
reasoning works in reverse order in which it starts from conclusion to incipient.
Conclusion
The production system structure of the search process facilitates in the interpretation of the
forward and backward reasoning. The forward and backward reasoning are differentiated on the
basis of their purpose and process, in which forward reasoning is directed by the initial data and
intended to find the goal while the backward reasoning is governed by goal instead of the data
and aims to discover the basic data and facts.
Topic:Matching: Intelligent matching is primarily used in maintaining and
extracting databases, specifically those that are very large and complex in
nature. It is generally implemented within database software, business
intelligence solutions or a big data analytics application. It works by applying
reasoning-based data matching techniques, which eventually deliver ideal or
substantially related query results.
The ability to scan each object for duplication within the target
database
The ability to remove duplicates within databases
The ability to search and extract relevant information from big data
repositories
The ability to compare data, objects or files for similaritie