23AD1504 Unit – 1 KEIS
UNIT I FIRST ORDER LOGIC
Knowledge based Systems – Syntax – Semantics – Interpretations –
Denotation – Satisfaction and models – Pragmatics – Explicit and
Implicit Beliefs - Logical Consequence – Expressing Knowledge - Basic
and Complex Facts – Terminological Facts – Entailment –Abstract
Individuals - Other Sorts of Facts
1.1: Introduction
What is knowledge?
✔ Knowledge is an awareness of facts, a familiarity with
individuals and situations, or a practical skill.
✔ Knowledge of facts, also called propositional knowledge, is often
characterized as true belief that is distinct from opinion or guesswork
by virtue of justification.
✔ Knowledge can be produced in many ways. The main source of
empirical knowledge is perception, which involves the usage of the
senses to learn about the external world.
✔ Introspection allows people to learn about their internal mental states
and processes.
✔ Other sources of knowledge include memory, rational intuition,
inference, and testimony
What is a Knowledge Base?
✔ An AI knowledge base is a centralized digital repository
designed to store, organize and provide access to information
using AI.
✔ Unlike conventional knowledge bases, an AI knowledge base is
dynamic and interactive. It uses machine learning (ML) and natural
language processing (NLP), enabling it to learn and evolve from user
interactions and data input.
[Link] Artificial intelligence & Data Science Page
1
23AD1504 Unit – 1 KEIS
✔ This allows the AI knowledge base to improve its accuracy and
relevance over time, adapting to the specific needs and patterns of its
users.
1.1.1: Knowledge Based System (KBS)
A knowledge-based system (KBS) is a computer program that reasons
and uses a centralized repository of data known as knowledge base to
solve complex problems. A KBS includes a database of facts and a set
of rules for how to use those facts to answer questions, make
decisions, or solve problems.
KBS are a form of AI designed to capture the knowledge of human experts to
support decision-making.
⮚ AIM of KBS: Replace human with a computer that contains all the relevant
knowledge from a particular domain.
⮚ KBS can assist in
● Decision making
● Human learning
● Creating a company-wide knowledge-sharing platform
A) COMPONENTS OF KBS:
1. Knowledge Base
2. Inference Engine
3. User Interface
[Link] Artificial intelligence & Data Science Page
2
23AD1504 Unit – 1 KEIS
A basic KBS works using a knowledge base and an interface engine.
1) The knowledge base is a repository of data that contains a collection
of information in a given field -- such as medical data.
Knowledge Representation:
● Knowledge is represented in a computer in the form of rules.
Consists of an IF part and THEN part.
● IF part lists a set of conditions in some logical combination.
● If the IF part of the rule is satisfied; consequently, the THEN part
can be concluded.
[Link] Artificial intelligence & Data Science Page
3
23AD1504 Unit – 1 KEIS
● Chaining of IF-THEN rules to form a line of reasoning.
2) The inference engine processes and locates data based on requests,
similar to a search engine. A reasoning system is used to draw
conclusions from data provided and make decisions based on if-then
rules, logic programming or constraint handling rules.
3) Users interact with the system through a user interface.
B) DEVELOPING A KBS:
✔ Determining the characteristics of the problem
✔ Knowledge engineer and domain expert work together closely to
describe the problem.
✔ The engineer then translates the knowledge into a computer-usable
language, and designs an inference engine, a reasoning structure that
uses the knowledge appropriately.
✔ He also determines how to integrate the use of uncertain knowledge in
the reasoning process, and what kinds of explanation would be useful
to the end user.
Advantages of KBS:
✔ Increase in available of expert knowledge
✔ Efficient and cost effective
✔ Consistency of answers
✔ Explanation of solution
✔ Deals with uncertainty
Disadvantages of KBS:
● Lack of common sense
● Inflexible, difficult to modify
● Restricted domain of expertise limited to KB
● Not always reliable
1.1.2: Types of knowledge-based systems
Some example types of knowledge-based systems include the following:
[Link] Artificial intelligence & Data Science Page
4
23AD1504 Unit – 1 KEIS
⮚ Blackboard systems. These systems enable multiple sources to input
new information into a system to help create solutions to potential
problems. Blackboard systems rely heavily on updates from human
experts.
⮚ Case-based systems. These systems use case-based reasoning to
create solutions to a problem. This system works by reviewing past
data of similar situations.
⮚ Classification systems. These systems analyze different data to
understand its classification status.
⮚ Eligibility analysis systems. These systems are used to determine a
user's eligibility for a specific service. A system asks a user guided
questions until it receives a disqualifying answer.
⮚ Expert systems. These are a common type of KBS that simulate
human expert decision-making in a particular field. Expert systems
provide solutions for problems as well as the explanations behind
them. For example, they could be used for calculations and
predictions.
⮚ Intelligent tutoring systems. These systems are designed to support
human learning and education. Intelligent tutoring systems provide
users with instructions and give feedback based on performance or
questions.
⮚ Medical diagnosis systems. These systems help diagnose patients by
inputting data or having a patient answer a series of questions. Based
on the responses, the KBS identifies a diagnosis and makes
recommendations medical professionals can use to determine a
patient's treatment.
⮚ Rule-based systems. These systems rely on human-specified rules to
analyze or change data to reach a desired outcome. For example, rule-
based systems might use if-then rules.
1.2: Syntax
Syntaxes are the rules which decide how we can construct legal
sentences in the logic.
It determines which symbol we can use in knowledge representation.
[Link] Artificial intelligence & Data Science Page
5
23AD1504 Unit – 1 KEIS
In FOL, there are two sorts of symbols:
Key Components of First-Order Logic
1. Constants:
● Definition: Constants are symbols that represent specific objects in
the domain.
● Examples: If a, b, and c are constants, they might represent specific
individuals like Alice, Bob, and Charlie.
2. Variables:
● Definition: Variables are symbols that can represent any object in the
domain.
● Examples: Variables such as x, y, and z can represent any object in
the domain.
3. Predicates:
● Definition: Predicates represent properties of objects or relationships
between objects.
● Examples: P(x) could mean “x is a person”, while Q(x, y) could mean “x
is friends with y”.
4. Functions:
● Definition: Functions map objects to other objects.
● Examples: f(x) could represent a function that maps an object x to
another object, like “the father of x”.
5. Quantifiers:
● Universal Quantifier (∀): Indicates that a statement applies to all
objects in the domain. For example, ∀x P(x) means “P(x) is true for all
x”.
● Existential Quantifier (∃): Indicates that there exists at least one
object in the domain for which the statement is true. For example, ∃x
P(x) means “There exists an x such that P(x) is true”.
6. Logical Connectives:
● Definition: These include ∧ (and), ∨ (or), ¬ (not), → (implies), and ↔ (if
and only if).
● Examples: P(x) ∧ Q(x, y) means “P(x) and Q(x, y) are both true”.
7. Equality:
● Definition: States that two objects are the same.
● Examples: x = y asserts that x and y refer to the same object.
[Link] Artificial intelligence & Data Science Page
6
23AD1504 Unit – 1 KEIS
Syntax of First-Order Logic:
The syntax of FOL defines the rules for constructing well-formed formulas:
● Atomic Formulas: The simplest formulas, which can be predicates
applied to terms.
Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
● Complex Formulas: Formed by combining atomic formulas
using logical connectives and quantifiers
Example:
Chinky is a cat and it likes fish: => cat (Chinky) ∧ likes(fish)
First-order logic statements can be divided into two parts:
o Subject: Subject is the main part of the statement.
o Predicate: A predicate can be defined as a relation, which binds two
atoms together in a statement.
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.
Examples:
✔ “All purple mushrooms are poisonous”
∀x (Mushroom(x)∧Purple(x)→Poisonous(x))
Here's the breakdown:
● Mushroom(x)Mushroom(x)Mushroom(x): x is a mushroom.
● Purple(x)Purple(x)Purple(x): x is purple.
[Link] Artificial intelligence & Data Science Page
7
23AD1504 Unit – 1 KEIS
● Poisonous(x)Poisonous(x)Poisonous(x): x is poisonous.
● ∀x\forall x∀x: For all x (for all objects x in the domain).
The statement asserts that for all x, if x is a mushroom and x is purple, then x is
poisonous. This ensures that we explicitly refer to mushrooms in the context of the
statement.
✔ “every gardener likes sun”
∀x(Gardener(x)→LikesSun(x))
Here's what each part of the statement means:
● Gardener(x)Gardener(x)Gardener(x): x is a gardener.
● LikesSun(x)LikesSun(x)LikesSun(x): x likes the sun.
● ∀x\forall x∀x: For all x (for all individuals x in the domain).
Therefore, ∀x (Gardener(x)→LikesSun(x)) asserts that for every individual x, if x is a
gardener, then x likes the sun.
1.3: Semantics
Semantics refers to the meaning and interpretation of words,
phrases, sentences, or symbols within a language or system. In the
context of a knowledge base system, semantics involves the
understanding and representation of knowledge in a way that
machines can interpret meaningfully.
1.3.1: Importance of Semantics in Knowledge Base Systems
✔ Understanding Context: Semantics allows the system to understand
the context of the information it stores, ensuring that queries can be
answered accurately.
✔ Interpreting Relationships: It helps in understanding the
relationships between different pieces of information, enabling the
system to infer new knowledge from existing data.
✔ Improving Accuracy: By understanding the meaning of data,
semantic systems can improve the accuracy and relevance of the
information retrieved.
[Link] Artificial intelligence & Data Science Page
8
23AD1504 Unit – 1 KEIS
✔ Facilitating Interoperability: Semantics enables different systems to
understand and work with each other’s data, facilitating data sharing
and integration across different platforms.
1.3.2: Key Components of Semantics in Knowledge Base Systems
✔ Ontologies: Ontologies are formal representations of a set of concepts
within a domain and the relationships between those concepts. They
are used to model domain knowledge in a structured form.
Example: Ontology for a medical knowledge base might include
concepts like "Disease," "Symptom," "Treatment," and the relationships
between them.
✔ Taxonomies: A taxonomy is a hierarchical classification of entities. It
helps in organizing knowledge by grouping similar entities under a
common category.
Example: In a library knowledge base, books might be categorized
under genres like "Fiction," "Non-Fiction," "Science Fiction," etc.
✔ RDF (Resource Description Framework): RDF is a framework for
representing information about resources in the web. It uses triples
(subject, predicate, object) to make statements about resources.
Example:
Subject: "Alice"
Predicate: "has favorite book"
Object: "Moby Dick"
✔ Rules and Inference Engines: Rules are used to derive new
information from existing data. Inference engines apply these rules to
the knowledge base to generate new knowledge.
Example: If a person has a favorite book, then that book must exist in the
system.
Example of Semantic Representation
Consider a simple knowledge base about people and their favorite books.
Here’s how semantics would be represented:
⮚ Facts:
● Alice is a person.
● "Moby Dick" is a book.
[Link] Artificial intelligence & Data Science Page
9
23AD1504 Unit – 1 KEIS
● Alice’s favorite book is "Moby Dick."
⮚ Ontology:
● Concepts: Person, Book
● Relationships: hasFavoriteBook
⮚ RDF Triples:
● (Alice, hasFavoriteBook, Moby_Dick)
● (Moby_Dick, isA, Book)
● (Alice, isA, Person)
⮚ Rule:
● If someone has a favorite book, that book must exist.
⮚ Query:
● What is Alice’s favorite book?
1.4: Interpretations
An interpretation of a first-order language assigns a denotation to
each non-logical symbol (predicate symbol, function symbol, or
constant symbol) in that language.
It also determines a domain of discourse that specifies the range of
the quantifiers. The result is that
✔ each term is assigned an object that it represents,
✔ each predicate is assigned a property of objects, and
✔ each sentence is assigned a truth value.
In this way, an interpretation provides semantic meaning to the
terms, predicates, and formulas of the language.
It involves specifying a domain of discourse D and a mapping I. Here's a
detailed look at these concepts:
[Link] Artificial intelligence & Data Science Page
10
23AD1504 Unit – 1 KEIS
1. Domain of Discourse (D):
The domain of discourse, D, is the set of all objects that we are talking
about in our logic system. Every variable in the logical formulas can take
values from this domain.
2. Mapping ( I ):
Mapping I (also known as interpretation function) defines how the elements
of the logical language are mapped to the elements in the domain of
discourse. This includes the assignment of:
● Constants: Specific objects in the domain.
● Functions: Mappings from tuples of domain objects to domain
objects.
● Predicates: Relations over the domain.
Formal Definition of Interpretation:
An interpretation I consist of:
1. Domain D: A non-empty set of objects.
2. Interpretation Function I It maps:
o Each constant symbol c to a specific element I(C) ∈ D.
o Each n-ary function symbol f to an n-ary function I(f):Dn →D :
o Each n-ary predicate symbol P to an n-ary relation I(P) ⊆ Dn
Example:
Let's illustrate this with a simple example:
Domain D:
D={1,2,3}
Constants:
● a is mapped to 1
● b is mapped to 2
Functions:
● f(x) is defined as x + 1 mod 3
[Link] Artificial intelligence & Data Science Page
11
23AD1504 Unit – 1 KEIS
Predicates:
● P(x) is true if x is even
● Q(x, y) is true if x < y
Detailed Mapping I:
● Constants:
o I(a) = 1
o I(b) = 2
● Functions:
o fI(1) = 2
o fI(2) = 3
o fI(3) = 1
● Predicates:
o I(P)={2} (since 2 is the only even number in the domain)
o I(Q)={(1,2),(1,3),(2,3)}
Evaluating Formulas Under Interpretation I:
● Atomic Formulas:
o P(a): Since I(a)=1,P(a) is false because 1 ∉ I(P)
o P(b): Since I(b) =2, P(b) is true because 2 ∈ I(P).
o Q(a,b): Since (1,2) ∈ I(Q), Q(a,b) is true.
● Complex Formulas:
o ∀x P(x): This statement is false because not all elements in D are
even.
o ∃x P(x): This statement is true because there exists an even
number in D (i.e., 2).
o ∀x ∃y Q(x,y): This statement is true because for every x in D,
there is a y in D such that x<y.
1.5: Denotation
Denotation refers to the meaning or reference of symbols (terms,
predicates, functions) within a particular interpretation.
Understanding denotation is crucial for defining how knowledge is
represented and manipulated in a knowledge-based system.
[Link] Artificial intelligence & Data Science Page
12
23AD1504 Unit – 1 KEIS
Denotation in First Order Logic:
1. Terms:
⮚ Constants: Denote specific objects in the domain.
⮚ Variables: Denote arbitrary objects in the domain (depending on the
context or assignment).
⮚ Function Terms: Denote objects obtained by applying functions to
other terms.
2. Predicates:
⮚ Denote relations among objects in the domain.
Formal Denotation:
Given a domain Dand an interpretation I:
● Constants:
o A constant c denotes a specific object in D, denoted by I(C).
● Variables:
o A variable x can denote any object in D. Its denotation depends
on the variable assignment g (a function from variables to objects
in D).
● Function Symbols:
o An n-ary function symbol f denotes a mapping I(f):D n → D. The
denotation of a function term f(t1,t2,...,tn) is I(f(I(t1),I(t2),...,I(tn)).
● Predicate Symbols:
o An n-ary predicate symbol P denotes a relation I(P) ⊆ Dn. An
atomic formula P(t1,t2,...,tn) is true if and only if (I(t 1),I(t2),...,I(tn))
∈ I(P).
Example:
Domain DDD:
D={1,2,3}
Constants:
[Link] Artificial intelligence & Data Science Page
13
23AD1504 Unit – 1 KEIS
● a denotes 1
Functions:
● f(x) denotes x + 1 mod 3
Predicates:
● P(x) denotes "x is even"
● Q(x, y) denotes "x < y"
Detailed Denotations:
● Constant:
o a denotes 1, so I(a)=1.
● Function Term:
o f(a) denotes I(f(I(a)) = I(f(1)=2
● Predicate:
o P(a) denotes I(P(1)). Since 1 ∉ {2}, P(a) is false.
o Q(a,b) denotes I(Q(1,2)). Since (1,2) ∈ {(1,2),(1,3),(2,3)}. Q(a,b) is
true.
1.6: Satisfaction and models
In First Order Logic (FOL), satisfaction and models are fundamental
concepts used to determine whether a logical formula is true under a
given interpretation.
[Link] Artificial intelligence & Data Science Page
14
23AD1504 Unit – 1 KEIS
[Link] Artificial intelligence & Data Science Page
15
23AD1504 Unit – 1 KEIS
[Link] Artificial intelligence & Data Science Page
16
23AD1504 Unit – 1 KEIS
[Link] Artificial intelligence & Data Science Page
17