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. However, how machines do all these things comes under knowledge
representation and reasoning. Hence, we can describe Knowledge representation as
following:
   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).
Types of knowledge:
1. Declarative Knowledge:
   o   Declarative knowledge is to know about something.
   o   It includes concepts, facts, and objects.
   o   It is also called descriptive knowledge and expressed in declarative sentences.
   o   It is simpler than procedural language.
2. Structural knowledge:
   o   Structural knowledge is basic knowledge to problem-solving.
   o   It describes relationships between various concepts such as kind of, part of, and
       grouping of something.
   o   It describes the relationship that exists between concepts or objects.
3. Procedural Knowledge
   o   It is also known as imperative knowledge.
   o   Procedural knowledge is a type of knowledge which is responsible for knowing
       how to do something.
   o   It can be directly applied to any task.
   o   It includes rules, strategies, procedures, agendas, etc.
   o   Procedural knowledge depends on the task on which it can be applied.
4. Meta-knowledge:
   o   Knowledge about the other types of knowledge is called Meta-knowledge.
5. Heuristic knowledge:
   o   Heuristic knowledge is representing knowledge of some experts in a filed or
       subject.
   o   Heuristic knowledge is rules of thumb based on previous experiences, awareness
       of approaches, and which are good to work but not guaranteed.
There are mainly four ways of knowledge representation which are given as follows:
   1. Logical Representation
   2. Semantic Network Representation
   3. Frame Representation
   4. Production Rules
1. Logical Representation:
Logic can be represented via agreed-upon syntax and objects. It deals with the
prepositions and has no ambiguity in meaning or interpretation. This type of
representation can help in logical reasoning and have a better representation of facts.
However, logical representations can be tricky to work with. The strict rules of syntax and
associations may make the process tricky. Logical representation is a language with some
concrete rules which deals with propositions and has no ambiguity in representation.
Logical representation means drawing a conclusion based on various conditions. This
representation lays down some important communication rules. It consists of precisely
defined syntax and semantics which supports the sound inference. Each sentence can be
translated into logics using syntax and semantics.
Syntax:
   o   Syntaxes are the rules which decide how we can construct legal sentences in the
       logic.
   o   It determines which symbol we can use in knowledge representation.
   o   How to write those symbols.
Semantics:
   o   Semantics are the rules by which we can interpret the sentence in the logic.
   o   Semantic also involves assigning a meaning to each sentence.
Logical representation can be categorized into mainly two logics:
      Propositional Logics (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.)
      Predicate logics (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.)
Advantages of Logical Representation:
   1. Logical representation enables us to do logical reasoning.
   2. Logical representation is the basis for the programming languages.
Disadvantages of Logical Representation:
   1. Logical representations have some restrictions and are challenging to work with.
   2. Logical representation technique may not be very natural, and inference may not
       be so efficient.
2. Semantic Network:
As the name suggests this type of representation works with a network of data. In the
network, the blocks define objects, and the edges (or arcs) define the relationships
between the blocks. Although semantic networks take more computational time, their use
is extensive as the knowledge represented is simple to understand. Semantic networks
are alternative of predicate logic for knowledge representation. In Semantic networks, we
can represent our knowledge in the form of graphical networks. This network consists of
nodes representing objects and arcs which describe the relationship between those
objects. Semantic networks can categorize the object in different forms and can also link
those objects. Semantic networks are easy to understand and can be easily extended.
Example: Following are some statements which we need to represent in the form of
nodes and arcs.
Statements:
   a. Jerry is a cat.
   b. Jerry is a mammal
   c. Jerry is owned by Priya.
   d. Jerry is brown colored.
   e. All Mammals are animal.
In the above diagram, we have represented the different type of knowledge in the form
of nodes and arcs. Each object is connected with another object by some relation.
Advantages of Semantic Network:
   1. Semantic networks are a natural representation of knowledge.
   2. Semantic networks convey meaning in a transparent manner.
   3. These networks are simple and easily understandable.
Drawbacks in Semantic Network:
   1. Semantic networks take more computational time at runtime as we need to
         traverse the complete network tree to answer some questions. It might be possible
         in the worst case scenario that after traversing the entire tree, we find that the
         solution does not exist in this network.
   2. Semantic networks do not have any standard definition for the link names.
   3. These networks are not intelligent and depend on the creator of the system.
   3. Frame Representation:
   A frame is a collection of the attributes and the associated values. Frames are also
   called slot-filler structures. This is because the slots are the attributes, and they are
   filled by the values of those attributes which represent the knowledge in the
   environment. Frames make the grouping of data and different object values easier.
   But sometimes, the inference mechanism is challenging to implement or use as it is a
   quite generalized approach.
   Frames are derived from semantic networks and later evolved into our modern-day
   classes and objects. A single frame is not much useful. Frames system consist of a
   collection of frames, which are connected. In the frame, knowledge about an object or
   event can be stored together in the knowledge base. The frame is a type of technology
   which is widely used in various applications including Natural language processing
   and machine visions.
   Example:
   Let's take an example of a frame for a book
 Slots                       Filters
 Title                       Artificial Intelligence
 Genre                       Computer Science
 Author                      Peter Norvig
 Edition                    Third Edition
 Year                       1996
 Page                       1152
Advantages of Frame Representation:
   1. The frame knowledge representation makes the programming easier by grouping
        the related data.
   2. The frame representation is comparably flexible and used by many applications in
        AI.
   3. It is very easy to add slots for new attribute and relations.
   4. It is easy to include default data and to search for missing values.
   5. Frame representation is easy to understand and visualize.
Disadvantages of Frame Representation:
   1. In frame system inference mechanism is not be easily processed.
   2. Inference mechanism cannot be smoothly proceeded by frame representation.
   3. Frame representation has a much generalized approach.
4. Production Rules:
Production rules system consist of (condition, action) pairs which mean, "If condition
then action". It has mainly three parts:
   o    The set of production rules
   o    Working Memory
   o    The recognize-act-cycle
In production rules agent checks for the condition and if the condition exists then
production rule fires and corresponding action is carried out. The condition part of the
rule determines which rule may be applied to a problem. And the action part carries out
the associated problem-solving steps. This complete process is called a recognize-act
cycle.
The working memory contains the description of the current state of problems-solving
and rule can write knowledge to the working memory. This knowledge match and may
fire other rules.
If there is a new situation (state) generates, then multiple production rules will be fired
together, this is called conflict set. In this situation, the agent needs to select a rule from
these sets, and it is called a conflict resolution.
Example:
   o   IF (at bus stop AND bus arrives) THEN action (get into the bus)
   o   IF (on the bus AND paid AND empty seat) THEN action (sit down).
   o   IF (on bus AND unpaid) THEN action (pay charges).
   o   IF (bus arrives at destination) THEN action (get down from the bus).
Advantages of Production Rule:
   1. The production rules are expressed in natural language.
   2. The production rules are highly modular, so we can easily remove, add or modify
       an individual rule.
Disadvantages of Production Rule:
   1. Production rule system does not exhibit any learning capabilities, as it does not
       store the result of the problem for the future uses.
   2. During the execution of the program, many rules may be active hence rule-based
       production systems are inefficient.
   Script:
   A script is a structured representation describing a stereotyped sequence of events
   in a particular context.
   Scripts are used in natural language understanding systems to organize a knowledge
   base in terms of the situations that the system should understand. Scripts use a
   frame-like structure to represent the commonly occurring experience like going to
   the movies eating in a restaurant, shopping in a supermarket, or visiting an
   ophthalmologist.
          Thus, a script is a structure that prescribes a set of circumstances that could be
          expected to follow on from one another.
       Components of a script:
       The components of a script include:
              Entry condition: These are basic condition which must be fulfilled before events
               in the script can occur.
              Results: Condition that will be true after events in script occurred.
              Props: Slots representing objects involved in events
              Roles: These are the actions that the individual participants perform.
              Track: Variations on the script. Different tracks may share components of the
               same scripts.
              Scenes: The sequence of events that occur.
       Describing a script, special symbols of actions are used. These are:
              Symbol                           Meaning                    Example
ATRANS                              transfer a relationship             give
                                    transfer physical location of an
PTRANS                                                                  go
                                    object
PROPEL                              apply physical force to an object   push
MOVE                                move body part by owner             kick
GRASP                               grab an object by an actor          hold
INGEST                              taking an object by an animal eat   drink
EXPEL                               expel from animal’s body            cry
MTRANS                              transfer mental information         tell
MBUILD                              mentally make new information       decide
                                    conceptualize or think about an
CONC                                                                    think
                                    idea
SPEAK                               produce sound                       say
ATTEND                              focus sense organ                   listen
       Example:-Script for going to the bank to withdraw money.
       SCRIPT : Withdraw money
       TRACK : Bank
PROPS : Money
Counter
Form
Token
Roles : P= Customer
E= Employee
C= Cashier
Entry conditions: P has no or less money.
The bank is open.
Results : P has more money.
Scene 1: Entering
P PTRANS P into the Bank
P ATTEND eyes to E
P MOVE P to E
Scene 2: Filling form
P MTRANS signal to E
E ATRANS form to P
P PROPEL form for writing
P ATRANS form to P
E ATRANS form to P
Scene 3: Withdrawing money
P ATTEND eyes to counter
P PTRANS P to queue at the counter
P PTRANS token to C
C ATRANS money to P
Scene 4: Exiting the bank
P PTRANS P to out of bank
Advantages of Scripts:
      Ability to predict events.
      A single coherent interpretation maybe builds up from a collection of
       observations.
Disadvantages of Scripts:
      Less general than frames.
      May not be suitable to represent all kinds of knowledge