Notes on Knowledge Representation

Knowledge Representation

  • Definition of Knowledge Representation (KR):
    Knowledge Representation involves defining and organizing information systematically so that artificial intelligence (AI) systems can effectively process and utilize it. It focuses on structuring knowledge in a way that enhances AI reasoning, decision-making, and problem-solving capabilities, ensuring that machines can understand and manipulate the knowledge effectively.


Representation and Mapping
  • Representation:
    The process of encoding information and knowledge within AI systems, where the choice of structure is crucial for accurately modeling complex real-world scenarios. Effective representation facilitates better understanding and interaction between AI systems and the knowledge they manage.

  • Facts:
    Precision in knowledge representation is divided into two mapping types:

  • Forward Representation:
    Involves mapping from facts to their representations, enabling inference from known facts to derive conclusions.

  • Backward Representation:
    Maps representations to facts, allowing verification of whether representations accurately reflect the underlying facts.


Forward Representation (Forward Chaining)
  • Process:
    This method begins with existing known facts and utilizes defined rules to apply logical inference, systematically deriving new information.

  • Steps:

    1. Start with known facts that are accepted as true.

    2. Apply established rules to these facts.

    3. Reach a predefined goal through logical inference.

  • Key Points:

    Start with Known Facts: Begin with a set of known facts or initial conditions.

    Apply Rules: Use inference rules to derive new facts from existing ones.

    Goal: The process continues until the desired goal or conclusion is reached or no more new facts can be derived.

  • Example:
    Given the facts: "All humans are mortal" and "Socrates is a human," one can apply the rule: if "X is human, then X is mortal," leading to the inference that "Socrates is mortal."


Backward Representation (Backward Chaining)
  • Process:
    This approach initiates from a specific goal and works backwards to check whether existing knowledge supports that goal.

  • Steps:

    1. Begin with a goal that needs to be validated.

    2. Revisit prior facts to ensure conditions for reaching the goal are satisfied.

  • Example:
    If the goal is to prove that "Socrates is mortal," one must verify the fact that "Socrates is a human." Confirming this fact supports the conclusion of Socrates' mortality.


Approaches to Knowledge Representation
  • Essential Properties:
    These properties ensure that knowledge representation systems are effective and efficient:

  1. Representational Adequacy:
    The capability to encompass all necessary knowledge and information within a specific domain, ensuring comprehensive representation.

  2. Inferential Adequacy:
    The ability to derive new knowledge or insights from existing structures and frameworks, enhancing learning and adaptability.

  3. Inferential Efficiency:
    The capacity to focus and perform inference swiftly based on newly acquired information, streamlining processing.

  4. Acquisitional Efficiency:
    The ease with which new information can be integrated into the existing knowledge base, promoting continual growth and accuracy.

  5. Domain-Specificity:
    Knowledge representation should be tailored to specific domains, ensuring contextual understanding and relevance in different applications.

  6. Robustness:
    The representation should be resilient to changes, capable of adapting to new information without losing coherence or accuracy.


Techniques for Knowledge Representation
  • Simple Relational Knowledge:
    Represents knowledge through facts or relationships, often analyzed via structured formats like database tables. For example, a database can store employee information with columns for EmployeeID, Name, and Department.

  • Inheritable Knowledge:
    This technique relies on the inheritance principle, wherein properties associated with a superclass are automatically conferred to its subclasses. An example includes: Animal (Superclass) → Mammal (Subclass) → Dog (Instance).

  • Inferential Knowledge:
    This method employs logical rules enabling the derivation of new facts from existing ones. For instance, a student's academic performance and participation in extracurricular activities could determine scholarship eligibility.

  • Procedural Knowledge:
    This type of knowledge describes the methods and algorithms for performing specific tasks. An example can be seen in cooking recipes, which outline sequences of steps to achieve a culinary outcome.

  • Semantic Networks:
    A representation of knowledge in the form of a graph, where nodes represent concepts and edges represent the relationships between them, facilitating better contextual understanding.

  • Frame Representation:
    Structures that hold data along with default values and relationships, enabling efficient context-specific knowledge storage and retrieval.


The Frame Problem
  • Definition:
    The frame problem addresses the difficulties in specifying how knowledge changes in response to actions within dynamic systems.

    The Frame Problem: The challenge is in efficiently and correctly specifying that most things do not change, without having to explicitly state this for every aspect of the world. It’s about finding a way to represent and reason about change without getting bogged down in describing all the things that stay the same.

    Distinct aspects include:

  • Direct Effects:
    Immediate changes that occur when an action is performed (e.g., turning on a light).

  • Indirect Effects (Non-effects):
    Facts that remain unchanged despite the actions, posing challenges in maintaining computational efficiency and relevance.

  • Efficiency and Complexity Issues:
    The inefficiency of AI systems arises when they are required to track numerous irrelevant unchanged facts, leading to increased computational demands.

  • Knowledge Update Mechanisms:
    Approaches to manage and update knowledge in response to dynamic changes, ensuring that the representation remains accurate and relevant despite alterations in the environment.


Propositional and Predicate Logic
  • Propositional Logic:
    This form captures facts and enables the formulation of conclusions based on structured true or false statements. However, its simplistic nature fails to account for complex relationships among objects.

    The main drawback of propositional logic is that it lacks expressiveness. It can only handle simple, atomic propositions and does not allow us to express relationships between objects or quantify statements. It can’t model real world complex scenarios. It can’t deduce something from the given facts.

    This limitation makes it inadequate for representing complex statements that involve variables or multiple objects.

  • Predicate Logic:
    Goes a step further by allowing functions to express the properties and relationships of objects within the logical framework, providing a richer system of analysis.

    Predicate logic (also known as first-order logic) extends propositional logic by introducing predicates, which can express properties of objects and relationships between objects. It also allows for the use of quantifiers like "for all" and "there exists" to make general statements about a domain.


Quantifiers
  • Universal Quantifier (∀):
    Signifies "for all"; it asserts that a statement holds true for every object within a specific domain.

  • Example: "All humans are mortal."

  • Existential Quantifier (∃):
    Denotes "there exists"; it indicates that at least one object meets the specified condition.

  • Example: "There exists a student who studies mathematics."


Instance and IsA Relationship
  • Instance Relationship:
    Defines a specific example belonging to a larger class. This relationship helps to differentiate between general categories (classes) and specific examples (instances) of those categories.

  • Example: Buddy serves as an instance of the Dog class.

  • IsA Relationship:
    Expresses subclass relationships, identifying the hierarchical structure among classes. While for a human, there is no confusion, but for computers each relationship has to be defined explicitly.

  • Example: A Dog is categorized as a subclass of Animal.


Resolution
  • Definition:
    A fundamental inference rule that enables the drawing of new conclusions from sets of logical clauses by systematically eliminating contradictions among statements.

  • where you assume the opposite of what you want to prove and then show that this leads to a contradiction. it plays a critical role in systems that need to perform logical reasoning, such as expert systems and AI-based decision-making systems. Resolution is a method used in propositional logic and first-order logic to prove the non-satisfiability of a set of logical sentences or to infer conclusions from a given knowledge base.

  • Convert to CNF: Transform all logical expressions into Conjunctive Normal Form, where the formula is a conjunction of disjunctions of literals. disjunction means (OR), conjunction means (AND)

  • Negate the Goal: The goal or hypothesis that we want to prove should be negated and added to the set of clauses.

  • Apply Resolution: Repeatedly apply the resolution rule to pairs of clauses until either:

    The empty clause is derived, proving the original hypothesis.

    No more resolutions are possible, meaning the hypothesis is not provable with the given knowledge base.

  • Example: Proving Tomorrow is a Holiday Using Contradiction

    Statement to Prove: "Tomorrow is a holiday."

    Rule: "If it’s Saturday, then tomorrow is a holiday."

    Fact: "Today is Saturday."

    Now, we want to use a contradiction to prove that tomorrow is a holiday.

    Steps:

    Assume the Opposite:

    Let’s assume the opposite of what we want to prove. So, we assume: "Tomorrow is not a holiday."

    Apply the Rule:

    We know from our rule: "If it’s Saturday, then tomorrow is a holiday."

    Since today is Saturday (a known fact), the rule says tomorrow should be a holiday.

    Check for Contradiction:

    Our assumption is: "Tomorrow is not a holiday."

    But the rule says: "Tomorrow is a holiday" because today is Saturday.

    Find the Contradiction:

    We now have two opposing statements:

    "Tomorrow is a holiday" (from the rule).

    "Tomorrow is not a holiday" (our assumption).

    Conclusion:

    Because these statements contradict each other, our assumption ("Tomorrow is not a holiday") must be false.

    Therefore, the conclusion is: Tomorrow is indeed a holiday.

    Summary:

    By assuming the opposite and finding a contradiction with the rule, we proved that our original statement ("Tomorrow is a holiday") must be true.

  • In logic, "If A, then B" can be rewritten as "Not A or B."For our rule:A is "It’s Saturday."

    B is "Tomorrow is a holiday."

    So, "If it’s Saturday, then tomorrow is a holiday" becomes: "Not Saturday or Holiday.“


    State What We Know

    Fact: "Today is Saturday."

    In symbols: "Saturday."

    Negate What We Want to Prove

    Since we want to prove "Tomorrow is a holiday," we assume the opposite to find a contradiction:

    Negated statement: "Tomorrow is not a holiday."

    In symbols: "¬Holiday."

    Use Resolution to Find the Contradiction

    Now, let’s combine the CNF forms:

    CNF Rule: ¬Saturday ∨ Holiday.

    Fact: Saturday.

    Negated Statement: ¬Holiday.

    Combine the Fact ("Saturday") with the Rule (¬Saturday ∨ Holiday):

    Since we know it’s Saturday, ¬Saturday is false, so we rely on Holiday to be true from the rule.

    After combining "Saturday" with "¬Saturday ∨ Holiday," we get: "Holiday."

    Now, combine with the negated statement ¬Holiday:

    You have: "Holiday" and "¬Holiday."

    Identify the Contradiction

    We end up with "Holiday" and "¬Holiday" which is a contradiction because something cannot be true and not true at the same time.

    Conclusion

    Because we reached a contradiction, our assumption (that tomorrow is not a holiday) must be wrong.

    Therefore, "Tomorrow is a holiday" is true!


Natural Deduction
  • Definition:
    A formal system designed for deriving conclusions by employing premises and various inference rules. These rules dictate the valid procedures for concluding from premises effectively.

  • Provides a framework for systematically deriving valid conclusions from a set of logical statements or premises.

  • Inference Rules:

  • Modus Ponens/Tollens:
    Rules allowing one to confidently derive conclusions based on conditional premises.

  • Modus Ponens

    Rule: If P implies Q (i.e., P→Q), and P is true, then Q must be true.

  • Modus Tollens:

  • Rule: If P→Q and ¬Q are true, then ¬P must be true.

  • Disjunction

    –If 𝑃 is true, then 𝑃∨𝑄 is also true.

  • Conjunction

    –If 𝑃 is true and 𝑄 is true, then 𝑃∧𝑄 is also true.

  • Implication

    –To prove 𝑃→𝑄, assume 𝑃 and show that 𝑄 follows.

  • Negation Rules:

    –To prove ¬𝑃, assume 𝑃 and derive a contradiction.¬𝑃 is equivalent to 𝑃→𝑄 for any proposition 𝑄. In classical logic, showing that a proposition is false can also be achieved by demonstrating that its negation leads to an inconsistency.

  • Guidelines governing the logical operations involved in statements, aiding in logical deduction and reasoning.

  • Quantification Rules:
    Regulations for deriving conclusions from quantified statements, enhancing the capacity for reasoning involving universal and existential qualifiers.