knowledge representation using propositional and predicate logic

Comprehensive study notes, diagrams, and exam preparation for knowledge representation using propositional and predicate logic.

Knowledge Representation Using Propositional and Predicate Logic

Definition

Knowledge representation using propositional and predicate logic is a formal technique in artificial intelligence in which information is encoded as logical statements so that a machine can store facts, apply rules of inference, and derive new conclusions.

  • In propositional logic, knowledge is represented using propositions, logical connectives, and truth values.
  • In predicate logic (also called first-order logic), knowledge is represented using predicates, variables, quantifiers, constants, and functions to describe more complex and detailed relationships.

This representation enables:

  • precise expression of knowledge,
  • logical reasoning,
  • inference of hidden facts,
  • and verification of consistency among statements.

Main Content

1. First Concept

Propositional Logic

Propositional logic is the simplest form of logical knowledge representation. A proposition is a declarative statement that is either true or false, but not both.

Examples of propositions:

  • “It is raining.”
  • “The door is open.”
  • “2 + 2 = 4.”

If we assign symbols to these statements:

  • P: It is raining
  • Q: The door is open

Then we can create more complex knowledge statements using logical connectives.

Common logical connectives:

AND

  • (): both statements must be true

OR

  • (): at least one statement is true

NOT

  • (¬): negation of a statement

IMPLIES

  • (): if one statement is true, then another follows

IFF

  • (): both statements have the same truth value

Example:

  • P → Q means “If it is raining, then the door is open.”

This form of representation is useful when the knowledge can be expressed as simple yes/no facts.

Key characteristics

  • Works with complete statements, not internal structure.
  • Easy to understand and implement.
  • Reasoning is done using truth tables and inference rules.
  • Limited in expressing relationships involving multiple objects.

Example of knowledge in propositional logic

Suppose:

  • P: The alarm rings
  • Q: There is a fire
  • R: The system is working

Rules:

  • Q → P (If there is a fire, the alarm rings)
  • R → Q (If the system is working, it can detect fire)

From these, we can infer:

  • If R is true, then P is also true.

Simple truth-table illustration

P Q P → Q
T T T
T F F
F T T
F F T

This table shows that an implication is false only when the first statement is true and the second is false.


2. Second Concept

Predicate Logic

Predicate logic is a more powerful form of knowledge representation because it can describe objects, their properties, and the relationships between them.

A predicate is a function-like symbol that becomes a proposition when variables are replaced with specific values.

Examples:

  • Human(Socrates) means Socrates is a human.
  • Loves(Rita, Raj) means Rita loves Raj.
  • GreaterThan(5, 3) means 5 is greater than 3.

Predicate logic includes:

Constants

  • : specific objects like Socrates, Delhi, 5

Variables

  • : placeholders like x, y, z

Predicates

  • : properties or relations such as Human(x), Parent(x, y)

Functions

  • : map objects to objects, such as FatherOf(x)

Quantifiers

  • :
  • universal quantifier meaning “for all”
  • existential quantifier meaning “there exists”

Example with quantifiers

  • ∀x Human(x) → Mortal(x)
  • “For every x, if x is human, then x is mortal.”
  • Human(Socrates)
  • “Socrates is human.”

From these, we can infer:

  • Mortal(Socrates)

This is much more expressive than propositional logic because it can represent general rules and apply them to many individuals.

Why predicate logic is important

  • It can represent structured knowledge.
  • It can express general rules in compact form.
  • It supports inference across objects and relationships.
  • It is suitable for domains like medicine, law, planning, and databases.

Example of relationship-based knowledge

Consider:

  • Parent(Anita, Rohan) means Anita is a parent of Rohan.
  • ∀x∀y Parent(x, y) → OlderThan(x, y) means every parent is older than the child.

This allows the system to reason about family relationships more naturally than propositional logic.

Visual relationship representation

Anita ──Parent──> Rohan
   │
   └──OlderThan──> Rohan

This shows how a fact about one relationship can support inference about another.


3. Third Concept

Inference and Reasoning in Logic

Inference is the process of deriving new information from existing knowledge using logical rules. In knowledge representation, inference is what makes logical statements useful for AI systems.

Common inference methods include:

Modus Ponens

  • : If P → Q and P are true, then Q is true.

Modus Tollens

  • : If P → Q and ¬Q are true, then ¬P is true.

Resolution

  • : A rule used widely in automated theorem proving.

Unification

  • : In predicate logic, matching expressions by finding substitutions for variables.

Example of modus ponens

Given:

  • Rain → WetGround
  • Rain

We infer:

  • WetGround

Example of predicate logic inference

Given:

  • ∀x Bird(x) → Animal(x)
  • Bird(Tweety)

We infer:

  • Animal(Tweety)

Reasoning process in AI

Logic-based reasoning typically involves:

  • storing facts,
  • storing rules,
  • matching facts with rules,
  • applying inference rules,
  • and producing conclusions.

Difference in reasoning power

  • Propositional logic can reason about whole statements only.
  • Predicate logic can reason about classes of objects, relationships, and multiple instances.

Example showing the limitation of propositional logic

To represent:

  • “Every student is intelligent,”
  • “Ali is a student,”
  • “Therefore Ali is intelligent,”

propositional logic would need separate symbols for each specific case, which becomes inefficient. Predicate logic represents it naturally as:

  • ∀x Student(x) → Intelligent(x)
  • Student(Ali)
  • Therefore Intelligent(Ali)

Working / Process

1. Identify the knowledge to be represented

  • Determine whether the information is a simple fact, a rule, or a relationship.
  • Decide whether the domain requires propositional logic or predicate logic.
  • Example: “It is sunny” is a simple proposition, while “Every student studies” needs predicate logic.

2. Convert natural language into logical form

  • Assign symbols to propositions in propositional logic.
  • Define predicates, constants, variables, and quantifiers in predicate logic.
  • Example:
    • Natural language: “All humans are mortal.”
    • Logical form: ∀x Human(x) → Mortal(x)

3. Apply inference rules to derive conclusions

  • Use logical equivalences, truth tables, modus ponens, resolution, and unification.
  • Check whether conclusions follow from the given facts and rules.
  • Example:
    • Human(Socrates)
    • ∀x Human(x) → Mortal(x)
    • Conclusion: Mortal(Socrates)

4. Check consistency and validity

  • Ensure that the knowledge base does not contain contradictions.
  • Validate whether conclusions are logically supported by the stored facts.
  • In AI systems, this helps avoid incorrect reasoning.

5. Use the results for decision-making

  • The inferred knowledge can support expert systems, search, diagnostics, planning, and automated reasoning.
  • Example: a medical expert system may infer a disease from symptoms and suggest treatment.

Advantages / Applications

Clear and unambiguous representation

  • Logic removes confusion by using precise symbolic forms instead of vague natural language.
  • This makes it suitable for formal reasoning and machine interpretation.

Supports automated inference

  • Systems can derive new facts from existing ones without being explicitly programmed for every case.
  • This is useful in expert systems, theorem proving, and intelligent agents.

Widely used in real-world AI applications

  • Propositional logic is used in simple rule-based systems and circuit design.
  • Predicate logic is used in knowledge bases, semantic web, natural language understanding, planning, and databases.

Allows structured reasoning

  • Predicate logic can represent objects, properties, and relationships in a compact and powerful way.
  • This is especially valuable in domains with many entities and rules.

Helps in consistency checking

  • Logical representation allows the detection of contradictions and invalid conclusions.
  • This improves reliability in AI systems.

Useful in education and formal analysis

  • Logic provides a strong theoretical foundation for understanding AI reasoning.
  • It also helps in proving correctness of programs and algorithms.

Summary

  • Propositional logic represents knowledge using true/false statements.
  • Predicate logic represents knowledge using objects, properties, and relationships.
  • Logic-based knowledge representation helps machines reason and derive new facts.
  • Important terms to remember: proposition, predicate, constant, variable, quantifier, inference, unification