AI Unit 3 notes
AI Unit 3 notes
To represent the above statements, PL logic is not sufficient, so we required some more powerful logic,
such as first-order logic.
First-Order logic:
o First-order logic is another way of knowledge representation in artificial intelligence. It is an extension to
propositional logic.
o FOL is sufficiently expressive to represent the natural language statements in a concise way.
o First-order logic is also known as Predicate logic or First-order predicate logic. First-order logic is a
powerful language that develops information about the objects in a more easy way and can also express
the relationship between those objects.
o First-order logic (like natural language) does not only assume that the world contains facts like
propositional logic but also assumes the following things in the world:
o Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus, ......
o Relations: It can be unary relation such as: red, round, is adjacent, or n-any relation such
as: the sister of, brother of, has color, comes between
o Function: Father of, best friend, third inning of, end of, ......
o As a natural language, first-order logic also has two main parts:
a. Syntax
b. Semantics
Variables x, y, z, a, b,....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
Atomic sentences:
o Atomic sentences are the most basic sentences of first-order logic. These sentences are formed from a
predicate symbol followed by a parenthesis with a sequence of terms.
o We can represent atomic sentences as Predicate (term1, term2, ......, term n).
Complex Sentences:
Consider the statement: "x is an integer.", it consists of two parts, the first part x is the subject of the
statement and second part "is an integer," is known as a predicate.
Quantifiers in First-order logic:
o A quantifier is a language element which generates quantification, and quantification specifies the
quantity of specimen in the universe of discourse.
o These are the symbols that permit to determine or identify the range and scope of the variable in the
logical expression. There are two types of quantifier:
a. Universal Quantifier, (for all, everyone, everything)
b. Existential quantifier, (for some, at least one).
Universal Quantifier:
Universal quantifier is a symbol of logical representation, which specifies that the statement within its
range is true for everything or every instance of a particular thing.
o For all x
o For each x
o For every x.
Example:
All man drink coffee.
Let a variable x which refers to a cat so all x can be represented in UOD as below:
∀x man(x) → drink (x, coffee).
It will be read as: There are all x where x is a man who drink coffee.
Existential Quantifier:
Existential quantifiers are the type of quantifiers, which express that the statement within its scope is
true for at least one instance of something.
It is denoted by the logical operator ∃, which resembles as inverted E. When it is used with a predicate
variable then it is called as an existential quantifier.
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
Example:
Some boys are intelligent.
It will be read as: There are some x where x is a boy who is intelligent.
Points to remember:
o The main connective for universal quantifier ∀ is implication →.
o The main connective for existential quantifier ∃ is and ∧.
Properties of Quantifiers:
o In universal quantifier, ∀x∀y is similar to ∀y∀x.
o In Existential quantifier, ∃x∃y is similar to ∃y∃x.
o ∃x∀y is not similar to ∀y∃x.
First, there are two principal components to consider for the language:
Syntax has to do with what ‘things’ (symbols, notations) one is allowed to use in the language and in what way;
there is/are a(n):
Alphabet
Language constructs
Sentences to assert knowledge
Semantics: Formal meaning, which has to do what those sentences with the alphabet and constructs are
supposed to mean.
Syntax
The lexicon of a first order language contains the following:
There is an (countably infinite) supply of symbols (signature): variables, functions, constants, and relations.
In other words: we can use these things to create ‘sentences’, like we have in natural language, but then
controlled and with a few extra figurines. Let us look first at how we can formalise a natural language sentence
into first order logic.
Example 3.1:
From Natural Language to First order logic (or vv.). Consider the following three sentences:
∀x(Animal(x)→Organism(x))
Observe the colour coding in the natural language sentences: ‘each’ and ‘all’ are different ways to say “ ∀∀”
and the ‘is a’ and ‘are’ in the first two sentences match the “→→”, and the combination of the “∀∀” and
“→→” in this particular construction can be put into natural language as ‘if ... then’.
Instead of talking about all objects of a particular type, one also can assert there are at least some of them; e.g.,
– “Aliens exist”
could be formalised as
∃xAlien(x)
∃x(Book(x)∧heavy(x))
where the ‘there are’ is another way to talk about “∃∃” and the ‘that’ hides (linguistically) the “∧∧”. A
formulation like “There is at least one book, and it is heavy” is a natural language rendering that is closer to the
structure of the axiom.
A sentence—or, more precisely, its precise meaning—such as “Each student must be registered for a degree
programme” requires a bit more consideration. There are at least two ways to say the same thing in the way the
sentence is formulated (we leave the arguments for and against each option for another time):
1. ∀x,y(registeredfor(x,y)→Student(x)∧DegreeProgramme(y))
“if there is a registered for relation, then the first object is a student and the second one a degree
programme”
∀x(Student(x)→∃yregisteredfor(x,y))
“Each student is registered for at least one y”, where the y is a degree programme (taken from the first
axiom)
2. ∀x(Student(x)→∃y(registeredfor(x,y)∧DegreeProgramme(y)))
But all this is still just syntax (it does not say what it really means), and it looks like a ‘free for all’ on how we
can use these symbols. This is, in fact, not the case, and the remainder of the definitions will make this more
precise, which will be illustrated in Example 2.1.2 afterward.
There is a systematic to the axioms in the examples, with the brackets, arrows, etc. Let us put this more
precisely now. We start from the basic elements and gradually build it up to more complex things.
Inference in First Order Logic
Substitution is a fundamental operation performed on terms and formulas. It occurs in all inference
systems in first-order logic. The substitution is complex in the presence of quantifiers in FOL. If we
write F[a/x], so it refers to substitute a constant "a" in place of variable "x".
Note: First-order logic is capable of expressing facts about some or all objects in the universe.
Equality:
First-Order logic does not only use predicate and terms for making atomic sentences but also uses
another way, which is equality in FOL. For this, we can use equality symbols which specify that the two
terms refer to the same object.
As in the above example, the object referred by the Brother (John) is similar to the object referred
by Smith. The equality symbol can also be used with negation to represent that two terms are not the
same objects.
o Universal Generalization
o Universal Instantiation
o Existential Instantiation
o Existential introduction
1. Universal Generalization:
o Universal generalization is a valid inference rule which states that if premise P(c) is true for any arbitrary
element c in the universe of discourse, then we can have a conclusion as ∀ x P(x).
Example: Let's represent, P(c): "A byte contains 8 bits", so for ∀ x P(x) "All bytes contain 8 bits.", it
will also be true.
2. Universal Instantiation:
o Universal instantiation is also called as universal elimination or UI is a valid inference rule. It can be applied
multiple times to add new sentences.
o The new KB is logically equivalent to the previous KB.
o As per UI, we can infer any sentence obtained by substituting a ground term for the variable.
o The UI rule state that we can infer any sentence P(c) by substituting a ground term c (a constant within
domain x) from ∀ x P(x) for any object in the universe of discourse.
Example:1.
Example: 2.
"All kings who are greedy are Evil." So let our knowledge base contains this detail as in the form of FOL:
So from this information, we can infer any of the following statements using Universal Instantiation:
3. Existential Instantiation:
o Existential instantiation is also called as Existential Elimination, which is a valid inference rule in first-order
logic.
o It can be applied only once to replace the existential sentence.
o The new KB is not logically equivalent to old KB, but it will be satisfiable if old KB was satisfiable.
o This rule states that one can infer P(c) from the formula given in the form of ∃x P(x) for a new constant
symbol c.
o The restriction with this rule is that c used in the rule must be a new term for which P(c ) is true.
Example:
So we can infer: Crown(K) ∧ OnHead( K, John), as long as K does not appear in the knowledge base.
o The above used K is a constant symbol, which is called Skolem constant.
o The Existential instantiation is a special case of Skolemization process.
4. Existential introduction
o An existential introduction is also known as an existential generalization, which is a valid inference rule in
first-order logic.
o This rule states that if there is some element c in the universe of discourse which has a property P, then
we can infer that there exists something in the universe which has the property P.
1. (a+b)2 = a2 + 2ab + b2
2. If x is real, then x 2 >= 0
3. If x is real, then x 2 < 0
4. The sun rises in the east.
5. The sun rises in the west.
Are all propositions because they have a specific truth value, true or false.
The branch of logic that deals with proposition is propositional logic.
2. 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 Predicate.
Difference between Propositional Logic and Predicate Logic :
Propositional logic is the logic that deals with Predicate logic is an expression consisting of
1 a collection of declarative statements which variables with a specified domain. It consists of
have a truth value, true or false. objects, relations and functions between the objects.
2 It is the basic and most widely used logic. Also It is an extension of propositional logic covering
known as Boolean logic. predicates and quantification.
3 A proposition has a specific truth value, either A predicate’s truth value depends on the variables’
true or false. value.
Substitution θ = {John/x} is a unifier for these atoms and applying this substitution, and both
expressions will be identical.
o The UNIFY algorithm is used for unification, which takes two atomic sentences and returns a
unifier for those sentences (If any exist).
o Unification is a key component of all first-order inference algorithms.
o It returns fail if the expressions do not match with each other.
o The substitution variables are called Most General Unifier or MGU.
E.g. Let's say there are two different expressions, P(x, y), and P(a, f(z)).
In this example, we need to make both above statements identical to each other. For this, we will
perform the substitution. P(x, y)......... (i)
P(a, f(z))......... (ii)
o Substitute x with a, and y with f(z) in the first expression, and it will be represented as a/x and
f(z)/y.
o With both the substitutions, the first expression will be identical to the second expression and
the substitution set will be: [a/x, f(z)/y].
o Predicate symbol must be same, atoms or expression with different predicate symbol can never
be unified.
o Number of Arguments in both expressions must be identical.
o Unification will fail if there are two similar variables present in the same expression.
Unification Algorithm:
Algorithm: Unify(Ψ1, Ψ2)
Step. 1: If Ψ1 or Ψ2 is a variable or constant, then:
a) If Ψ1 or Ψ2 are identical, then return NIL.
b) Else if Ψ1is a variable,
a. then if Ψ1 occurs in Ψ2, then return FAILURE
b. Else return { (Ψ2/ Ψ1)}.
c) Else if Ψ2 is a variable,
a. If Ψ2 occurs in Ψ1 then return FAILURE,
b. Else return {( Ψ1/ Ψ2)}.
d) Else return FAILURE.
Step.2: If the initial Predicate symbol in Ψ1 and Ψ2 are not same, then return FAILURE.
Step. 3: IF Ψ1 and Ψ2 have a different number of arguments, then return FAILURE.
Step. 4: Set Substitution set(SUBST) to NIL.
Step. 5: For i=1 to the number of elements in Ψ1.
a) Call Unify function with the ith element of Ψ1 and ith element of Ψ2, and put the
result into S.
b) If S = failure then returns Failure
c) If S ≠ NIL then do,
a. Apply S to the remainder of both L1 and L2.
b. SUBST= APPEND(S, SUBST).
Step.6: Return SUBST.
For each pair of the following atomic sentences find the most general unifier (If exist).
5. Find the MGU of Q(a, g(x, a), f(y)), Q(a, g(f(b), a), x)}
SUBST θ= {b/y}
S1 => {Q(a, g(f(b), a), f(b)); Q(a, g(f(b), a), f(b))}, Successfully Unified.
The primary motivation behind lifting is to achieve a level of abstraction that allows AI systems to
operate on a more generalized scale. It involves identifying commonalities among specific instances
and creating representations or rules that can be applied to a class of similar situations. This
abstraction facilitates the handling of complexity and variability within a domain.
Consider the example of lifting in the context of planning. Instead of creating specific plans for
individual scenarios, lifting involves developing more abstract plans that can be applied to a range of
situations. This enables the AI system to reason about actions and goals at a higher level, promoting
flexibility and adaptability.
Lifting is crucial for creating AI systems that can handle diverse and dynamic environments. It allows
for the development of more flexible and robust models, reducing the need for domain-specific
knowledge engineering and promoting the generalization of learned concepts.
In conclusion, lifting is a key concept in AI that involves the abstraction and generalization of
operations or concepts, enabling AI systems to operate at higher levels of generality and adaptability,
which is essential for handling the complexities of real-world scenarios.
Forward Chaining
Forward chaining is also known as a forward deduction or forward reasoning method when using an
inference engine. Forward chaining is a form of reasoning which start with atomic sentences in the
knowledge base and applies inference rules (Modus Ponens) in the forward direction to extract more
data until a goal is reached.
The Forward-chaining algorithm starts from known facts, triggers all rules whose premises are satisfied,
and add their conclusion to the known facts. This process repeats until the problem is solved.
Properties of Forward-Chaining:
Consider the following famous example which we will use in both approaches:
Example:
"As per the law, it is a crime for an American to sell weapons to hostile nations. Country A, an
enemy of America, has some missiles, and all the missiles were sold to it by Robert, who is an
American citizen."
To solve the above problem, first, we will convert all the above facts into first-order definite clauses,
and then we will use a forward-chaining algorithm to reach the goal.
o It is a crime for an American to sell weapons to hostile nations. (Let's say p, q, and r are
variables)
American (p) ∧ weapon(q) ∧ sells (p, q, r) ∧ hostile(r) → Criminal(p) ...(1)
o Country A has some missiles. ?p Owns(A, p) ∧ Missile(p). It can be written in two definite
clauses by using Existential Instantiation, introducing new Constant T1.
Owns(A, T1) ......(2)
Missile(T1) .......(3)
o All of the missiles were sold to country A by Robert.
?p Missiles(p) ∧ Owns (A, p) → Sells (Robert, p, A) ......(4)
o Missiles are weapons.
Missile(p) → Weapons (p) .......(5)
o Enemy of America is known as hostile.
Enemy(p, America) →Hostile(p) ........(6)
o Country A is an enemy of America.
Enemy (A, America) .........(7)
o Robert is American
American(Robert). ..........(8)
Step-2:
At the second step, we will see those facts which infer from available facts and with satisfied premises.
Rule-(1) does not satisfy premises, so it will not be added in the first iteration.
Rule-(4) satisfy with the substitution {p/T1}, so Sells (Robert, T1, A) is added, which infers from the
conjunction of Rule (2) and (3).
Rule-(6) is satisfied with the substitution(p/A), so Hostile(A) is added and which infers from Rule-(7).
Step-3:
At step-3, as we can check Rule-(1) is satisfied with the substitution {p/Robert, q/T1, r/A}, so we can
add Criminal(Robert) which infers all the available facts. And hence we reached our goal statement.
Example:
In backward-chaining, we will use the same above example, and will rewrite all the rules.
Backward-Chaining proof:
In Backward chaining, we will start with our goal predicate, which is Criminal(Robert), and then infer
further rules.
Step-1:
At the first step, we will take the goal fact. And from the goal fact, we will infer other facts, and at last,
we will prove those facts true. So our goal fact is "Robert is Criminal," so following is the predicate of
it.
Step-2:
At the second step, we will infer other facts form goal fact which satisfies the rules. So as we can see in
Rule-1, the goal predicate Criminal (Robert) is present with substitution {Robert/P}. So we will add all
the conjunctive facts below the first level and will replace p with Robert.
Step-3:t At step-3, we will extract further fact Missile(q) which infer from Weapon(q), as it satisfies Rule-
(5). Weapon (q) is also true with the substitution of a constant T1 at q.
Step-4:
At step-4, we can infer facts Missile(T1) and Owns(A, T1) form Sells(Robert, T1, r) which satisfies
the Rule- 4, with the substitution of A in place of r. So these two statements are proved here.
Step-5:
At step-5, we can infer the fact Enemy(A, America) from Hostile(A) which satisfies Rule- 6. And hence
all the statements are proved true using backward chaining.
Following is the difference between the forward chaining and backward chaining:
o Forward chaining as the name suggests, start from the known facts and move forward by
applying inference rules to extract more data, and it continues until it reaches to the goal,
whereas backward chaining starts from the goal, move backward by using inference rules to
determine the facts that satisfy the goal.
o Forward chaining is called a data-driven inference technique, whereas backward chaining is
called a goal-driven inference technique.
o Forward chaining is known as the down-up approach, whereas backward chaining is known as
a top-down approach.
o Forward chaining uses breadth-first search strategy, whereas backward chaining uses depth-
first search strategy.
o Forward and backward chaining both applies Modus ponens inference rule.
o Forward chaining can be used for tasks such as planning, design process monitoring,
diagnosis, and classification, whereas backward chaining can be used for classification and
diagnosis tasks.
o Forward chaining can be like an exhaustive search, whereas backward chaining tries to avoid the
unnecessary path of reasoning.
o In forward-chaining there can be various ASK questions from the knowledge base, whereas in
backward chaining there can be fewer ASK questions.
o Forward chaining is slow as it checks for all the rules, whereas backward chaining is fast as it
checks few required rules only.
1. Forward chaining starts from known facts Backward chaining starts from the goal and
and applies inference rule to extract more works backward through inference rules to find
data unit it reaches to the goal. the required facts that support the goal.
5. Forward chaining tests for all the available Backward chaining only tests for few required
rules rules.
6. Forward chaining is suitable for the planning, Backward chaining is suitable for diagnostic,
monitoring, control, and interpretation prescription, and debugging application.
application.
7. Forward chaining can generate an infinite Backward chaining generates a finite number of
number of possible conclusions. possible conclusions.
8. It operates in the forward direction. It operates in the backward direction.
9. Forward chaining is aimed for any Backward chaining is only aimed for the required
conclusion. data.
Resolution
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.
Note: To better understand this topic, firstly learns the FOL in AI.
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:
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)].
To better understand all the above steps, we will take an example in which we will apply resolution.
Example:
In the first step we will convert all the given statements into its first order logic.
In First order logic resolution, it is required to convert the FOL into CNF as CNF form makes easier for
resolution proofs.
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.
In this statement, we will apply negation to the conclusion statements, which will be written as
¬likes(John, Peanuts)
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.
Knowledge Representation
o 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.
o 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.
o 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:
o Object: All the facts about objects in our world domain. E.g., Guitars contains strings, trumpets
are brass instruments.
o Events: Events are the actions which occur in our world.
o Performance: It describe behavior which involves knowledge about how to do things.
o Meta-knowledge: It is knowledge about what we know.
o Facts: Facts are the truths about the real world and what we represent.
o 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:
2. Procedural Knowledge
4. Heuristic knowledge:
5. Structural knowledge:
Let's suppose if you met some person who is speaking in a language which you don't know, then how
you will able to act on that. The same thing applies to the intelligent behavior of the agents.
As we can see in below diagram, there is one decision maker which act by sensing the environment
and using knowledge. But if the knowledge part will not present then, it cannot display intelligent
behavior.
AI knowledge cycle:
An Artificial intelligence system has the following components for displaying intelligent behavior:
o Perception
o Learning
o Knowledge Representation and Reasoning
o Planning
o Execution
The above diagram is showing how an AI system can interact with the real world and what components
help it to show intelligence. AI system has Perception component by which it retrieves information from
its environment. It can be visual, audio or another form of sensory input. The learning component is
responsible for learning from data captured by Perception comportment. In the complete cycle, the
main components are knowledge representation and Reasoning. These two components are involved
in showing the intelligence in machine-like humans. These two components are independent with each
other but also coupled together. The planning and execution depend on analysis of Knowledge
representation and reasoning.
o It is the simplest way of storing facts which uses the relational method, and each fact about a
set of the object is set out systematically in columns.
o This approach of knowledge representation is famous in database systems where the
relationship between different entities is represented.
o This approach has little opportunity for inference.
Player1 65 23
Player2 58 18
Player3 75 24
2. Inheritable knowledge:
o In the inheritable knowledge approach, all data must be stored into a hierarchy of classes.
o All classes should be arranged in a generalized form or a hierarchal manner.
o In this approach, we apply inheritance property.
o Elements inherit values from other members of a class.
o This approach contains inheritable knowledge which shows a relation between instance and
class, and it is called instance relation.
o Every individual frame can represent the collection of attributes and its value.
o In this approach, objects and values are represented in Boxed nodes.
o We use Arrows which point from objects to their values.
o Example:
3. Inferential knowledge:
man(Marcus)
∀x = man (x) ----------> mortal (x)s
4. Procedural knowledge:
o Procedural knowledge approach uses small programs and codes which describes how to do
specific things, and how to proceed.
o In this approach, one important rule is used which is If-Then rule.
o In this knowledge, we can use various coding languages such as LISP language and Prolog
language.
o We can easily represent heuristic or domain-specific knowledge using this approach.
o But it is not necessary that we can represent all cases in this approach.
1. 1. Representational Accuracy:
KR system should have the ability to represent all kind of required knowledge.
2. 2. Inferential Adequacy:
KR system should have ability to manipulate the representational structures to produce new
knowledge corresponding to existing structure.
3. 3. Inferential Efficiency:
The ability to direct the inferential knowledge mechanism into the most productive directions
by storing appropriate guides.
4. 4. Acquisitional efficiency- The ability to acquire the new knowledge easily using automatic
methods.
Monotonic Reasoning:
In monotonic reasoning, once the conclusion is taken, then it will remain the same even if we add some
other information to existing information in our knowledge base. In monotonic reasoning, adding
knowledge does not decrease the set of prepositions that can be derived.
To solve monotonic problems, we can derive the valid conclusion from the available facts only, and it
will not be affected by new facts.
Monotonic reasoning is not useful for the real-time systems, as in real time, facts get changed, so we
cannot use monotonic reasoning.
Example:
It is a true fact, and it cannot be changed even if we add another sentence in knowledge base like, "The
moon revolves around the earth" Or "Earth is not round," etc.
6. Non-monotonic Reasoning
In Non-monotonic reasoning, some conclusions may be invalidated if we add some more information
to our knowledge base.
Logic will be said as non-monotonic if some conclusions can be invalidated by adding more knowledge
into our knowledge base.
"Human perceptions for various things in daily life, "is a general example of non-monotonic reasoning.
Example: Let suppose the knowledge base contains the following knowledge:
o Birds can fly
o Penguins cannot fly
o Pitty is a bird
So from the above sentences, we can conclude that Pitty can fly.
However, if we add one another sentence into knowledge base "Pitty is a penguin", which concludes
"Pitty cannot fly", so it invalidates the above conclusion.
o For real-world systems such as Robot navigation, we can use non-monotonic reasoning.
o In Non-monotonic reasoning, we can choose probabilistic facts or can make assumptions.
o In non-monotonic reasoning, the old facts may be invalidated by adding new sentences.
o It cannot be used for theorem proving.
Probabilistic Reasoning
Probabilistic reasoning:
Probabilistic reasoning is a way of knowledge representation where we apply the concept of probability
to indicate the uncertainty in knowledge. In probabilistic reasoning, we combine probability theory with
logic to handle the uncertainty.
We use probability in probabilistic reasoning because it provides a way to handle the uncertainty that
is the result of someone's laziness and ignorance.
In the real world, there are lots of scenarios, where the certainty of something is not confirmed, such
as "It will rain today," "behavior of someone for some situations," "A match between two teams or two
players." These are probable sentences for which we can assume that it will happen but not sure about
it, so here we use probabilistic reasoning.
In probabilistic reasoning, there are two ways to solve problems with uncertain knowledge:
o Bayes' rule
o Bayesian Statistics
As probabilistic reasoning uses probability and related terms, so before understanding probabilistic
reasoning, let's understand some common terms:
Probability: Probability can be defined as a chance that an uncertain event will occur. It is the numerical
measure of the likelihood that an event will occur. The value of probability always remains between 0
and 1 that represent ideal uncertainties.
ADVERTISEMENT
ADVERTISEMENT
We can find the probability of an uncertain event by using the below formula.
Sample space: The collection of all possible events is called sample space.
Random variables: Random variables are used to represent the events and objects in the real world.
Prior probability: The prior probability of an event is probability computed before observing new
information.
Posterior Probability: The probability that is calculated after all evidence or information has taken into
account. It is a combination of prior probability and new information.
Certainty Factor
The Certainty factor is a measure of the degree of confidence or belief in the truth of a
proposition or hypothesis. In AI, the certainty factor is often used in rule-based systems to
evaluate the degree of certainty or confidence of a given rule.
Certainty factors are used to combine and evaluate the results of multiple rules to make a
final decision or prediction. For example, in a medical diagnosis system, different symptoms
can be associated with different rules that determine the likelihood of a particular disease.
The certainty factors of each rule can be combined to produce a final diagnosis with a degree
of confidence.
In Artificial Intelligence, the numerical values of the certainty factor represent the degree of
confidence or belief in the truth of a proposition or hypothesis. The numerical scale typically
ranges from -1 to 1, and each value has a specific meaning:
-1: Complete disbelief or negation: This means that the proposition or hypothesis is
believed to be false with absolute certainty.
0: Complete uncertainty: This means that there is no belief or confidence in the truth
or falsehood of the proposition or hypothesis.
+1: Complete belief or affirmation: This means that the proposition or hypothesis is
believed to be true with absolute certainty.
Values between 0 and 1 indicate varying degrees of confidence that the proposition or
hypothesis is true.
Values between 0 and -1 indicate varying degrees of confidence that the proposition or
hypothesis is false.
For example, a certainty factor of 0.7 indicates a high degree of confidence that the
proposition or hypothesis is true, while a certainty factor of -0.3 indicates a moderate degree
of confidence that the proposition or hypothesis is false.
Practical Applications of Certainty Factor
Certainty factor has practical applications in various fields of artificial intelligence, including:
Fuzzy Logic
Fuzzy logic contains the multiple logical values and these values are the truth values of a variable or
problem between 0 and 1. This concept was introduced by Lofti Zadeh in 1965 based on the Fuzzy
Set Theory. This concept provides the possibilities which are not given by computers, but similar to
the range of possibilities generated by humans.
In the Boolean system, only two possibilities (0 and 1) exist, where 1 denotes the absolute truth value
and 0 denotes the absolute false value. But in the fuzzy system, there are multiple possibilities present
between the 0 and 1, which are partially false and partially true.
The Fuzzy logic can be implemented in systems such as micro-controllers, workstation-based or large
network-based systems for achieving the definite output. It can also be implemented in both hardware
or software.
1. This concept is flexible and we can easily understand and implement it.
2. It is used for helping the minimization of the logics created by the human.
3. It is the best method for finding the solution of those problems which are suitable for
approximate or uncertain reasoning.
4. It always offers two values, which denote the two possible solutions for a problem and statement.
5. It allows users to build or create the functions which are non-linear of arbitrary complexity.
6. In fuzzy logic, everything is a matter of degree.
7. In the Fuzzy logic, any system which is logical can be easily fuzzified.
8. It is based on natural language processing.
9. It is also used by the quantitative analysts for improving their algorithm's execution.
10. It also allows users to integrate with the programming.
1. Rule Base
2. Fuzzification
3. Inference Engine
4. Defuzzification
2. Fuzzification
Fuzzification is a module or component for transforming the system inputs, i.e., it converts the crisp
number into fuzzy steps. The crisp numbers are those inputs which are measured by the sensors and
then fuzzification passed them into the control systems for further processing. This component divides
the input signals into following five states in any Fuzzy Logic system:
3. Inference Engine
This component is a main component in any Fuzzy Logic system (FLS), because all the information is
processed in the Inference Engine. It allows users to find the matching degree between the current
fuzzy input and the rules. After the matching degree, this system determines which rule is to be added
according to the given input field. When all rules are fired, then they are combined for developing the
control actions.
4. Defuzzification
Defuzzification is a module or component, which takes the fuzzy set inputs generated by
the Inference Engine, and then transforms them into a crisp value. It is the last step in the process of
a fuzzy logic system. The crisp value is a type of value which is acceptable by the user. Various
techniques are present to do this, but the user has to select the best one for reducing the errors.
Membership Function
The membership function is a function which represents the graph of fuzzy sets, and allows users to
quantify the linguistic term. It is a graph which is used for mapping each element of x to the value
between 0 and 1.
This function of Membership was introduced in the first papers of fuzzy set by Zadeh. For the Fuzzy set
B, the membership function for X is defined as: μB:X → [0,1]. In this function X, each element of set B is
mapped to the value between 0 and 1. This is called a degree of membership or membership value.
1. The run time of fuzzy logic systems is slow and takes a long time to produce outputs.
2. Users can understand it easily if they are simple.
3. The possibilities produced by the fuzzy logic system are not always accurate.
4. Many researchers give various ways for solving a given statement using this technique which
leads to ambiguity.
5. Fuzzy logics are not suitable for those problems that require high accuracy.
6. The systems of a Fuzzy logic need a lot of testing for verification and validation.
By TutorialsPoint:-
The conventional logic block that a computer can understand takes precise input and
produces a definite output as TRUE or FALSE, which is equivalent to human’s YES or NO.
The inventor of fuzzy logic, Lotfi Zadeh, observed that unlike computers, the human
decision making includes a range of possibilities between YES and NO, such as −
CERTAINLY YES
POSSIBLY YES
CANNOT SAY
POSSIBLY NO
CERTAINLY NO
The fuzzy logic works on the levels of possibilities of input to achieve the definite output.
Implementation
It can be implemented in systems with various sizes and capabilities ranging from
small micro-controllers to large, networked, workstation-based control systems.
It can be implemented in hardware, software, or a combination of both.
Fuzzification Module − It transforms the system inputs, which are crisp numbers,
into fuzzy sets. It splits the input signal into five steps such as −
LP x is Large Positive
MP x is Medium Positive
S x is Small
MN x is Medium Negative
LN x is Large Negative
Knowledge Base − It stores IF-THEN rules provided by experts.
Inference Engine − It simulates the human reasoning process by making fuzzy
inference on the inputs and IF-THEN rules.
Defuzzification Module − It transforms the fuzzy set obtained by the inference
engine into a crisp value.
The membership functions work on fuzzy sets of variables.
Membership Function
All membership functions for LP, MP, S, MN, and LN are shown as below −
The triangular membership function shapes are most common among various
other membership function shapes such as trapezoidal, singleton, and
Gaussian.
Here, the input to 5-level fuzzifier varies from -10 volts to +10 volts. Hence
the corresponding output also changes.
Development
Step 1 − Define linguistic variables and terms
Linguistic variables are input and output variables in the form of simple words
or sentences. For room temperature, cold, warm, hot, etc., are linguistic
terms.
RoomTemp.
Very_Cold Cold Warm Hot Very_Hot
/Target
Build a set of rules into the knowledge base in the form of IF-THEN-ELSE
structures.
Automotive Systems
Automatic Gearboxes
Four-Wheel Steering
Vehicle environment control
Hi-Fi Systems
Photocopiers
Still and Video Cameras
Television
Domestic Goods
Microwave Ovens
Refrigerators
Toasters
Vacuum Cleaners
Washing Machines
Environment Control
Air Conditioners/Dryers/Heaters
Humidifiers
Advantages of FLSs
Mathematical concepts within fuzzy reasoning are very simple.
You can modify a FLS by just adding or deleting rules due to flexibility of fuzzy
logic.
Fuzzy logic Systems can take imprecise, distorted, noisy input information.
FLSs are easy to construct and understand.
Fuzzy logic is a solution to complex problems in all fields of life, including
medicine, as it resembles human reasoning and decision making.
Disadvantages of FLSs
There is no systematic approach to fuzzy system designing.
They are understandable only when simple.
They are suitable for the problems which do not need high accuracy.
Syntactic Processing
Here, comes the role of syntactic processing techniques which can help to understand the
relationship between individual words in the sentence.
Lexical processing aims at data cleaning and feature extraction, by using techniques such
as lemmatization, removing stopwords, correcting misspelled words, etc. However,
in syntactic processing, our aim is to understand the roles played by each of the words in the
sentence, and the relationship among words and to parse the grammatical structure of sentences to
understand the proper meaning of the sentence.
How Does Syntactic Processing Work?
To understand the working of syntactic processing, lets again start with an example.
For example, consider the sentence “The cat sat on the mat.” Syntactic processing would involve
identifying important components in the sentence such as “cat” as a noun, “sat” as a verb, “on” as
a preposition, and “mat” as a noun. It would also involve understanding that “cat” is the subject of
the sentence and “mat” is the object.
Tokenization is the process of breaking up a sentence into individual words or tokens. Part-of-
speech (PoS) tagging involves identifying the part of speech of each token. Parsing is the process of
analyzing the grammatical structure of a sentence, including identifying the subject, verb, and object.
The semantic analysis involves understanding the meaning of the sentence in context.
There are several different techniques used in syntactic processing, including rule-based methods,
statistical methods, and machine learning algorithms. Each technique has its own strengths and
weaknesses, and the choice of technique depends on the specific task and the available data.
In the subsequent lessons, we will learn the concept of parsing and different parsing techniques, PoS
Tagging, and semantic analysis.
Syntactic processing is a crucial component of many NLP tasks, including machine translation,
sentiment analysis, and question-answering. Without accurate syntactic processing, it is difficult for
computers to understand the underlying meaning of human language.
Syntactic processing also plays an important role in text generation, such as in chatbots or
automated content creation. By understanding the grammatical structure of a sentence, computers
can generate more natural and fluent textual content.
Conclusion
Syntactic processing is a fundamental task in NLP, which involves analyzing the grammatical structure
of a sentence to understand its meaning. It is a crucial component of many NLP tasks specifically text
generation and machine translation, and its accuracy is essential for computers to understand
complex human language.
By GFG:-
1. Syntactic Analysis:
There are different rules for different languages. Violation of these rules will give a syntax error.
Here the sentence is transformed into the structure that represents a correlation between the words.
This correlation might violate the rules occasionally. The syntax represents the set of rules that the
official language will have to follow. For example, “To the movies, we are going.” Will give a
syntax error. The syntactic analysis uses the results given by morphological analysis to develop
the description of the sentence. The sentence which is divided into categories given by the
morphological process is aligned into a defined structure. This process is called parsing. For
example, the cat chases the mouse in the garden, would be represented as:
Here the sentence is broken down according to the categories. Then it is described in a
hierarchical structure with nodes as sentence units. These parse trees are parsed while the syntax
analysis run and if any error arises the processing stops and it displays syntax error. The parsing
can be top-down or bottom-up.
Top-down: Starts with the first symbol and parse the sentence according to the
grammar rules until each of the terminals in the sentence is parsed.
Bottom-up: Starts with the sentence which is to be parsed and apply all the rules
backwards till the first symbol is reached.
Semantic Processing
Semantic Analysis
In the case of semantic analysis, a computer understands the meaning of a text by analyzing the text as
a whole and not just looking at individual words. The context in which a word is used is very important
when it comes to semantic analysis. Let’s revisit the same example: “Does it all sound like a joke to
you?” While the word “joke” may be positive on its own, something sounding like a joke may not be so.
Thus, the context here is derived by analyzing the whole sentence instead of isolated words.
The semantic analysis does throw better results, but it also requires substantially more training and
computation. We will now understand why.
Pragmatic Processing
Pragmatic Analysis:
The pragmatic analysis means handling the situation in a much more practical or realistic manner
than using a theoretical approach. As we know that a sentence can have different meanings in
various situations. For example, The average is 18.
The average is 18. (average may be of sequence)
The average is 18. (average may be of a vehicle)
The average is 18. (average may be of a mathematical term)
We can see that for the same input there can be different perceptions. To interpret the meaning of
the sentence we need to understand the situation. To tackle such problems we use pragmatic
analysis. The pragmatic analysis tends to make the understanding of the language much more
clear and easy to interpret.
Implementation:
The five phases discussed above for Language processing are required to follow an order. Each phase
takes its input from the previous phase’s output and sends it along to the next phase for processing.
While this process input can get rejected half-way if it does not follow the rules defining it for the
next phase.
Also, More than one phase can start processing together. This may happen due to ambiguity between
the phases. For instance, consider the sentence
Is the electric vehicle Tesla car?
The above sentence has four noun phrases at the end which will be required to form noun phrases to
give the sentence of the form:
“Is the A B?” where A & B represents the noun phrases we require. While syntax analysis there will
be the following choices available:
While performing the syntactic analysis all of these choices look applicable, but to get the correct
phrases we require to analyze the semantics. When we apply semantic analysis the only options
making sense are “electric vehicle” and “tesla car”. Hence, we can say that these processes are
separated but they can communicate in different ways.
Language is a structure which follows different rules. Natural Language processes the written form
of language concerning the rules developed. The main focus is to erase ambiguity & uncertainty from
the language to make the communication much easier.