Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

KNOWLEDGE AND REPRESENTATION

Knowledge and Representation are distinct entities that play a central but distinguishable roles in
intelligent system. Knowledge is a description of the world. It determines a system's competence
by what it knows. Representation is the way knowledge is encoded. It defines the performance of
a system in doing something.
KNOWLEDGE
In general, we seem to mean three things by our use of the word "knowledge."
 First, we use it to refer to a state of knowing, by which we also mean to be acquainted or
familiar with, to be aware of, to recognize or apprehend facts, methods, principles,
techniques and so on. This common usage corresponds to what is often referred to as "know
about."
 Second, we use the word "knowledge" to refer to what Peter Senge calls "the capacity for
action," an understanding or grasp of facts, methods, principles and techniques sufficient to
apply them in the course of making things happen. This corresponds to "know how."
 Third, we use the term "knowledge" to refer to codified, captured and accumulated facts,
methods, principles, techniques and so on. When we use the term this way, we are referring
to a body of knowledge that has been articulated and captured in the form of books, papers,
formulas, procedure manuals, computer code and so on.

KNOWLEDGE PROGRESSION
Knowledge is a progression that starts with data. By organizing or analyzing the data, we
understand what the data means, and this becomes information. The interpretation or evaluation
of information yield knowledge. An understanding of the principles embodied within the
knowledge is wisdom.

 Data is viewed as collection of disconnected facts.


Example:
It is raining.
 Information emerges when relationships among facts are established and understood;
"who”, “what", "where", and "when".
Example:
The temperature dropped 15 degrees and then it started raining.

Notes prepared by Peninah J. Limo Page 1


 Knowledge emerges when relationships among patterns are identified and understood;
"how".
Example:
If the humidity is very high and the temperature drops substantially, then atmospheres are
unlikely to hold the moisture, so it rains.
 Wisdom is the pinnacle of understanding, uncovers the principles of relationships that
describe patterns. "why".
Example :
Encompasses understanding of all the interactions that happen between raining, evaporation,
air currents, temperature gradients, changes, and raining.

KNOWLEDGE MODEL (BELLINGER 1980)


The model tells, that as the degree of connectedness and understanding increase, we progress
from data through information and knowledge to wisdom.

This model represents transitions and understanding.


 The transitions are from data, to information, to knowledge, and finally to wisdom;
 The understanding support the transitions from one stage to the next stage.

The distinctions between data, information, knowledge, and wisdom are not very discrete.
 Data and information deal with the past; they are based on the gathering of facts and adding
context.
 Knowledge deals with the present that enable us to perform.
 Wisdom deals with the future, acquire vision for what will be, rather than for what is or was.

Notes prepared by Peninah J. Limo Page 2


TYPES KNOWLEDGE
There are four main types of knowledge this include:
 Tacit
 Explicit
 Declarative
 Procedural

(i) Tacit knowledge(knowing how)


Tacit knowledge is embedded in human mind through experience and jobs. Know-how and
learning embedded within the minds of people. Personal wisdom and experience, context-
specific, more difficult to extract and codify. Tacit knowledge includes insights, intuitions.

(ii) Explicit knowledge(knowing that)


Explicit knowledge is codified and digitized in books, documents,reports, memos, etc.
Documented information that can facilitate action. Knowledge what is easily identified,
articulated, shared and employed.
Tacit knowledge vs. Explicit knowledge
Tacit knowledge Explicit knowledge
Exists within a human being; it is embodied Exists outside a human being
Difficult to articulate formally Can be articulated formally.
Difficult to share/communicate Can be shared, copied, processed and stored.
Hard to steal or copy Easy to steal or copy
Drawn from experience, action, subjective Drawn from artifact of some type as principle,
insight. procedure, process, concepts.

(iii) Declarative knowledge


Declarative or descriptive is knowledge about something. This knowledge is expressed as
declarations of propositions (or factual knowledge). Declarative knowledge can be represented as
logic, and is simpler to manipulate, but is more flexible and has the potential to be used in ways
beyond the original intent.

(iv) Procedural knowledge

This is knowledge about how to do something. i.e These explains what to do in order to reach a
certain conclusion.

Notes prepared by Peninah J. Limo Page 3


Procedural Knowledge vs Declarative Knowledge
Procedural knowledge Declarative knowledge
Procedures, rules; strategies, agendas, models concepts, objects, facts, propositions,
assertions, semantic nets; logic and
descriptive models
focuses on tasks that must be performed to refers to representations of objects and events;
reach a particular objective or goal. knowledge about facts. and relationships;
Knowledge about "how to do, something" Knowledge about "that something is true or
false.

RELATIONSHIP AMONG KNOWLEDGE TYPES


The relationship among explicit, implicit, tacit, declarative and procedural knowledge are
illustrated below.

The figure above shows:


 Declarative knowledge is tied to "describing" and Procedural knowledge is tied to
"doing."
 The arrows connecting explicit with declarative and tacit with procedural, indicate the
strong relationships exist among them.
 The arrow connecting declarative and procedural indicates that we often develop
procedural knowledge as a result of starting with declarative knowledge. i.e., we often
"know about" before we "know how".
Therefore, we may view all procedural knowledge as tacit, and all declarative knowledge as
explicit.

Notes prepared by Peninah J. Limo Page 4


KNOWLEDGE TYPOLOGY MAP
The map shows that, Tacit knowledge comes from experience, action, subjective insight and
Explicit knowledge comes from principle, procedure, process, concepts, via transcribed content or
artifact of some type.

 Facts : are data or instance that are specific and unique.


 Concepts : are class of items, words, or ideas that are known by a common name and share
common features.
 Processes: are flow of events or activities that describe how things work rather than how to
do things.
 Procedures: are series of step-by-step actions and decisions that result in the achievement of
a task.
 Principles: are guidelines, rules, and parameters that govern; principles allow to make
predictions and draw implications; principles are the basic building blocks of theoretical
models (theories).
These artifacts are used in the knowledge creation process to create two types of knowledge:
declarative and procedural

KNOWLEDGE REPRESENTATION
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.
But how machines do all these things comes under knowledge representation.

Notes prepared by Peninah J. Limo Page 5


Knowledge representation is the study of how knowledge about the world can be represented and
what kinds of reasoning can be done with that knowledge. In order to use knowledge and reason
with it, you need what we call a representation and reasoning system (RRS).
Machines used with RRS involves contains the following:
 Knowledge: The information related to the environment is stored in the machine.
 Reasoning: The ability of the machine to understand the stored knowledge.
 Intelligence: The ability of the machine to make decisions on the basis of the stored
information.
A representation and reasoning system is composed of a language to communicate with a
computer, a way to assign meaning to the language, and procedures to compute answers given
input in the language.
Intuitively, an RRS lets you tell the computer something in a language where you have
some meaning associated with the sentences in the language, you can ask the computer
questions, and the computer will produce answers that you can interpret according to the
meaning associated with the language. A knowledge representation language is defined by two
aspects:
 The syntax of a language describes the possible configurations that can constitute
sentences.
 The semantics determines the facts in the world to which the sentences refer.
For example, the syntax of the language of arithmetic expressions says that if x and y
are expressions denoting numbers, then x > y is a sentence about numbers. The
semantics of the language says that x > y is false when y is a bigger number than x,
and true otherwise. From the syntax and semantics, we can derive an inference
mechanism for an agent that uses the language.

The knowledge that needs to be presented in artificial intelligence systems can include:

 Objects: Facts about objects in our world. e.g. Guitars have string trumpets are brass
instruments.
 Events: Actions that occur in our world.e.g. Steve Vai played the guitar in Frank Zappas
Band.
 Performance: A behavior like playing guitar involves knowledge about how to do
things.
 Meta-knowledge: Knowledge about what we know.e.g. Bob’s Robot who plans a trip. I
know that it can read street signs along a way to find out where it is. Thus in solving
problems in AI we must represent knowledge and there are two entities to deal with.
 Facts: Truth about the real world and what we represent. This can be regarded as the
knowledge level.

Notes prepared by Peninah J. Limo Page 6


 Knowledge-base: The knowledge base is the main component of human intelligence.
This refers to a group of relevant data or information on any field, description, and more.
For example, a knowledge base on designing a car model.

Techniques of Knowledge Representation

The Knowledge Representation techniques are often based on:


 Semantic Networks
 Frames
 Production Rules
 Logic as a knowledge representation language
o Propositional logic
o Predicate logic/calculus
 Neural networks

(i) Semantic Network


Semantic network is a knowledge representation schema that captures knowledge as a graph.
The nodes denote objects or concepts, their properties and corresponding values. The arcs
denote relationships between the nodes.

Both nodes and arcs are generally labeled. This representation consists of basically two types of
relations:

 IS-A relation (Inheritance)

Notes prepared by Peninah J. Limo Page 7


 Kind-of-relation

Inheritance is one of the main kind of reasoning done in semantic nets. Properties are inherited
through IS-A and A-KIND-OF relationship, any member of a set inherits the properties of that
set.
IS-A relation is often used to link a class and its superclass. Some links (e.g. haspart) are
inherited along ISA paths

A-KIND-OF (often abbreviated to AKO) denotes set inclusion.

Example 2

The data in semantic nets can be reasoned about in order to produce systems that have
knowledge about a particular domain. For example if you wanted to know whether a particular
animal was a mammal you could consult a semantic network to see if it was connected to the
concept of mammals. If it was then you could reasonably conclude that the animal was a
mammal.

Notes prepared by Peninah J. Limo Page 8


ADVANTAGES
Using Semantic Networks for representing knowledge has particular advantages:
1. Easy to understand and construct
2. The semantics, i.e. real world meanings, are clearly identifiable.
3. There are very powerful representational possibilities as a result of “is a” and “is a part
of” inheritance hierarchies.
4. Efficient in space requirements i.e Objects represented only once and Relationships
handled by pointers
5. They can be used to represent events and natural language sentences.

DISADVANTAGES
1. Semantic networks do not have any standard definition for the link names.
2. 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.
3. Semantic networks try to model human-like memory (Which has 1015 neurons and links)
to store the information, but in practice, it is not possible to build such a vast semantic
network.
4. These types of representations are inadequate as they do not have any equivalent
quantifier, e.g., for all, for some, none, etc.
5. These networks are not intelligent and depend on the creator of the system.

(ii) Frames
A frame is also known as slot-filter knowledge representation in artificial intelligence. 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. For example

Notes prepared by Peninah J. Limo Page 9


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.

A frame is a composite data structure which consists of three components frame name ,attributes
(slots) and values (fillers: list of values, range, string, etc.)

Example: Book Frame

Book Frame

Slot  Filler

• Title  AI. A modern Approach

• Author  Russell & Norvig

• Year  2003

Slots in the frame could contain information such as:

 Frame identification information.


 Relationship of this frame to other frames.
 Descriptors of requirements for frame match. for example the chair frame might specify a
flat base on four vertical supports with a back support at 90 degrees to the base.
 Procedural information on the use of the structure called demons.

Notes prepared by Peninah J. Limo Page 10


 Frame default information: for example as default a chair has four legs.
 New instance information. Many frame slots are left unspecified until a particular
instance of the structure is identified. For example the colour of the chair might not be
filled in until a particular instance is identified.
 Frames support inheritance - Class types are represented by frames which omit the detail
of objects of the class, for example the frame representing a three legged chair object
could inherit the slots of a class frame representing an abstract chair and augment these
with its own particular detail to describe the new object.

ADVANTAGES
 Makes programming easier by grouping related knowledge
 Easily understood by non-developers
 Expressive power
 Easy to set up slots for new properties and relations
 Easy to include default information and detect missing values

DISADVANTAGES

 No standards (slot-filler values)


 More of a general methodology than a specific representation:
 Frame for a class-room will be different for a professor and for a maintenance worker
 No associated reasoning/inference mechanisms

(iii) Production Rules


These are a form of knowledge representation which have found widespread application in AI
particularly in the area of Expert Systems. A production system provides pattern-directed control
of a problem-solving process and consists of a set of production rules, a working memory, and a
recognize–act control cycle. A production system consists of three basic components:

1. A set of rules- set of production rules of the form a condition→ action. The condition
determines when a given rule is applied, and the action determines what happens when it
is applied.

Example:
IF (at bus stop AND bus arrives) THEN action (get into the bus)
IF (on the bus AND paid AND empty seat) THEN action (sit down).

Notes prepared by Peninah J. Limo Page 11


IF (on bus AND unpaid) THEN action (pay charges).
IF (bus arrives at destination) THEN action (get down from the bus.

Action part is also called THEN part, conclusion, consequent, succeedent, or the right
side of the rule. Actions are executed when conditions are true and the rule is fired.

2. Working memory- a working memory contains a description of the current state of the
world in a reasoning process. This description is a pattern that is matched against the
condition part of a production to select appropriate problem-solving actions.
3. The recognize–act cycle – The control structure for a production system is simple:
working memory is initialized with the beginning problem description. The current state
of the problem-solving is maintained as a set of patterns in working memory. These
patterns are matched against the conditions of the production rules; this produces a subset
of the production rules, called the conflict set, whose conditions match the patterns in
working memory. The productions in the conflict set are said to be enabled

Recognize-Act Cycle

Typically, our production systems will have a rule interpreter that takes the form of a Recognize-
Act Cycle. This cycle has four stages:

i. Match the condition/premise patterns in the rules against the elements in the working
memory to identify the set of applicable rules.
ii. If there is more than one rule that can be ‘fired’ (i.e. that can be applied), then use a
Conflict Resolution strategy to choose which one to apply. If no rules are applicable, then
stop.
iii. Apply the chosen rule, which may result in adding new items to the working memory, or
in deleting old ones.
iv. Check if the terminating condition is fulfilled. If it is, then stop. Otherwise, return to
stage 1.

FORWARD CHAINING AND BACKWARD CHAINING

Forward chaining and backward chaining are very important concepts of search that is done
with production system. The inference engine is a component of the intelligent system that
applies logical rules to the knowledge base to infer new information from known facts and uses
the two modes of forward and backward chaining.

Notes prepared by Peninah J. Limo Page 12


Forward-chaining

Forward chaining or data-driven inference works by repeatedly: starting from the current state,
matching the premises of the rules (the IF parts/ antecedent), and performing the corresponding
actions (the THEN parts/ consequent) that usually update the knowledge base or working
memory. The process continues until no more rules can be applied, or some cycle limit is met.

Advantages of forward chaining

The advantages of forward chaining are:

1. Forward reasoning can be employed to draw multiple conclusions.


2. Forward deduction provides a reasonable basis for reaching conclusions.
3. There are no limits on the data derived from it. This makes it more flexible than backward
chaining.

Disadvantages of Forward Chaining


The disadvantages of forward chaining are:

1. The process of forward chaining may be time-consuming. It may take a lot of time to
eliminate and synchronize available data. Many rules may be applicable at each stage – so
how should we choose which one to apply next at each stage.
2. Unlike backward chaining, the explanation of facts or observations for this type of chaining
is not very clear. The whole process is not directed towards a goal, so how do we know when
to stop applying the rules. The backward chaining uses a goal-driven method that arrives at
conclusions efficiently
3. Forward chaining is only good to be used on problems that have a single starting point and
multiple possible endpoints. It becomes rather inefficient when used on problems that have
several starting points and just a single endpoint.
Notes prepared by Peninah J. Limo Page 13
Example 1

Suppose that the goal is to conclude the color of a pet named Fritz, given that he croaks and eats
flies, and that the rule base contains the following four rules:

Rule 1: If X croaks and X eats flies - Then X is a frog

Rule 2: If X chirps and X sings - Then X is a canary


Rule 3: If X is a frog - Then X is green

Rule 4: If X is a canary - Then X is yellow

Let us illustrate forward chaining by following the pattern of a computer as it evaluates the rules.
Assume the following facts:

Fritz croaks

Fritz eats flies

With forward reasoning, the inference engine can derive that Fritz is green in a series of steps:

1. Since the base facts indicate that "Fritz croaks" and "Fritz eats flies", the antecedent of rule #1
is satisfied by substituting Fritz for X, and the inference engine concludes: Fritz is a frog

2. The antecedent of rule #3 is then satisfied by substituting Fritz for X, and the inference engine
concludes: Fritz is green

Example 2

Rule 1: If A and C Then F

Rule 2: If A and E Then G

Rule 3: If B Then E

Rule 4: If G Then D

Problem

Prove that If A and B true Then D is true


Solution

Notes prepared by Peninah J. Limo Page 14


Backward chaining

Backward chaining or goal-driven inference works towards a final state by looking at the
working memory to see if the sub-goal states already exist there. If not, the actions (the THEN
parts/ consequent) of the rules that will establish the sub-goals are identified, and new sub-goals
are set up for achieving the premises of those rules (the IF parts/ antecedent).

In goal-oriented terminology we can say that the mechanism starts from a general goal, and
decomposes that general goal into subgoals (or problems to be solved) until it stumbles on some

Notes prepared by Peninah J. Limo Page 15


data that assert that a subgoal is reached. More technically speaking it walks down a decision
tree.

Advantage of Backward Chaining

 The search is goal directed, so we only apply the rules that are necessary to achieve the goal.

Disadvantage of Backward Chaining

 The process of reasoning can only start if the endpoint is known.


 It doesn’t deduce multiple solutions or answers.
 It only derives data that is needed, which makes it less flexible than forward chaining.

Example1

For example, suppose a new pet, Fritz, is delivered in an opaque box along with two facts about
Fritz:

Fritz croaks

Fritz eats flies

The goal is to decide whether Fritz is green, based on a rule base containing the following four
rules using backward chaining:

Rule 1: If X croaks and X eats flies - Then X is a frog

Rule 2: If X chirps and X sings - Then X is a canary

Rule 3: If X is a frog - Then X is green

Rule 4: If X is a canary - Then X is yellow

solution

With backward reasoning, an inference engine can determine whether Fritz is green in four steps.
To start, the query is phrased as a goal assertion that is to be proved:

"Fritz is green".

1. Fritz is substituted for X in rule #3 to see if its consequent matches the goal, so rule #3
becomes:

Notes prepared by Peninah J. Limo Page 16


If Fritz is a frog – Then Fritz is green

Since the consequent matches the goal ("Fritz is green"), the rules engine now needs to see if the
antecedent ("Fritz is a frog") can be proved. The antecedent therefore becomes the new goal:
Fritz is a frog

2. Again substituting Fritz for X, rule #1 becomes:

If Fritz croaks and Fritz eats flies – Then Fritz is a frog

Since the consequent matches the current goal ("Fritz is a frog"), the inference engine now needs
to see if the antecedent ("Fritz croaks and eats flies") can be proved. The antecedent therefore
becomes the new goal:

Fritz croaks and Fritz eats flies

3. Since this goal is a conjunction of two statements, the inference engine breaks it into two sub-
goals, both of which must be proved

Fritz croaks

Fritz eats flies

4. To prove both of these sub-goals, the inference engine sees that both of these sub-goals were
given as initial facts. Therefore, the conjunction is true:

Fritz croaks and Fritz eats flies

therefore the antecedent of rule #1 is true and the consequent must be true:

Fritz is a frog

therefore the antecedent of rule #3 is true and the consequent must be true:

Fritz is green

This derivation therefore allows the inference engine to prove that Fritz is green. Rules #2 and #4
were not used.

Example 2

Rule 1: If A and C Then F

Rule 2: If A and E Then G

Notes prepared by Peninah J. Limo Page 17


Rule 3: If B Then E

Rule 4: If G Then D

Problem

Prove that If A and B true Then D is true

Solution

COMPARISON BETWEEN FORWARD AND BACKWARD CHAINING

1) The exploration of knowledge has different mechanisms in forward and backward chaining.
Backward chaining is more focused and tries to avoid exploring unnecessary paths of reasoning.
Forward chaining, on the other hand is like an exhaustive search .

2) Backward chaining systems are good for diagnostic and classification tasks, but they are not
good for planning, design, process monitoring, and quite a few other tasks. Forward chaining
systems can handle all these tasks.

Notes prepared by Peninah J. Limo Page 18


3) Forward chaining system, includes writing rules to manage sub goals. Whereas, backward
chaining systems automatically manage sub goals

4) Lots of output Hypothesis + Lots of data up front => Use Forward Chaining Fewer output
Hypothesis + Must query for data=> Use Backward Chaining

5) Backward chaining engines query for new facts, whereas forward chaining relies on the
application asserting facts to the rule engine.

6) In backward chaining, the search is goal directed, so rules can be applied that are necessary to
achieve the goal. But in forward chaining the whole process is not directed towards goal, so
when to stop the rules in not known

7) If the facts that has to be established lead to a large number of conclusion, but the number of
ways to reach that particular conclusion is small, then there is more information out rather than
information in, then backward chaining should be used. On the other hand, if the number of ways
to reach a particular conclusion is large, but the number of conclusions likely to be reach using
the facts is small, then forward chaining is preferred.

CONFLICT RESOLUTION STRATEGIES

1. Refractoriness - Once a given rule fires then that same rule will be disallowed for
subsequent firing.( Avoid applying a rule more than once for the same situation )
2. Recency - Rules that apply to the most recently working elements are chosen in preference
to those which apply to older working elements.
3. Specificity - Rules which have more conditions on the left hand side are chosen in
preference to those with fewer conditions.
4. Rank rules according to "firing desirability " a priority.
5. Give priority to those rules which are least recently used.
6. Choose the rules that have the largest number of consequents, with the assumption that more
is better.

Example for Conflict Resolution

Consider the following set of rules:

R1: IF: engine does not turn AND battery is not flat

THEN: ask user to test starter motor

Notes prepared by Peninah J. Limo Page 19


R2: IF: there is no spark

THEN: ask user to check the points

R3: IF: engine turns AND engine does not start

THEN: ask user to check the spark

R4: IF: engine does not turn

THEN: ask user to check the battery

R5: IF: battery is flat

THEN: ask user to charge battery AND EXIT

If the initial facts are “engine does not turn” and “battery is not flat”, the conflict set is:

{ 〈 R1, engine does not turn, battery is not flat 〉, 〈 R4, engine does not turn 〉 } We can see that
our general conflict resolution strategy 4 would work well here.

Advantages of Production rule:

 The production rules are expressed in natural language.


 The production rules are highly modular, so we can easily remove, add or modify an
individual rule.

Disadvantages of Production rule:

 Production rule system does not exhibit any learning capabilities, as it does not store the
result of the problem for the future uses.
 During the execution of the program, many rules may be active hence rule-based
production systems are inefficient.

(iv) LOGIC
Logic is a classical approach of representing Knowledge. It was developed by philosophers and
mathematicians as a calculus of the process of making inferences from facts. Logic is concerned
with the truth of statements about the world. It includes: Syntax, Semantics and Inference
Procedure.

Notes prepared by Peninah J. Limo Page 20


1. Syntax: Specifies the symbols in the language about how they can be combined to form
sentences. The facts about the world are represented as sentences in logic
2. Semantic: Specifies how to assign a truth value to a sentence based on its meaning in the
world. It specifies what facts a sentence refers to. A fact is a claim about the world, and it
may be TRUE or FALSE.
3. Inference Procedure: Specifies methods for computing new sentences from an existing
sentences.

(a) PROPOSITION LOGIC


The simplest, and most abstract logic we can study is called propositional logic. Propositional
logic is also called Propositional calculus, Sentential calculus, or Boolean algebra. A proposition
is a declarative statements which are either true or false (but not both) in a given context. If
proposition is true, then truth value is "true" and if proposition is false, then truth value is "false".
For example:
Sentence Truth value Proposition

“Apple is expensive” “true” Yes

“Grass is green” “true” Yes

“2+5=5” “false” No

“Jack is a male”, “true Yes

Concepts of Propositional Logic


Atomic Proposition
An atomic proposition is one whose truth or falsity does not depend on the truth or falsity of any
other proposition. So all the above propositions are atomic. Atomic Proposition can be combined
with so-called logical connectives to yield composite propositions.
Propositional Variable
A propositional variable represents an arbitrary proposition. Now, rather than write out
propositions in full, we will abbreviate them by using propositional variables. We represent
propositional variables with uppercase letters like P and Q. If we do this, we must define what
we mean by writing something like:
Let P be John Major is prime Minister.
Argument

Notes prepared by Peninah J. Limo Page 21


An argument consists of a sequence of statements called premises and a statement called a
conclusion. An argument is valid if the conclusion is true whenever the premises are all true.
Example:
Ladybugs are purple or green.
Ladybugs are not green.
Therefore ladybugs are purple.
This is one example of an argument form that is called disjunctive syllogism.

Let P be: Ladybugs are purple.


Let Q be: Ladybugs are green.
Rewritten argument:
P or Q
not Q
Therefore P

This argument is valid, but it isn’t very meaningful since P and Q are not true.

Logical Connectives
Logical connectives are used to build complex propositions from simpler ones. In Propositional
logic, we have the following five connectives at our disposal:
 conjunction: ∧ (and)
 disjunction: ∨ (or)
 implication: → (if then)
 bi-implication: ↔ (if and only if)
 negation: ¬ (not)

TRUTH TABLES
Truth tables represent the relationship between the truth values of propositions and compound
propositions formed from those propositions.

(i) AND
Any two propositions can be combined to form a third proposition called the conjunction of the
original propositions.
Definition: If p and q are arbitrary propositions, then the conjunction of p and q is written
P^Q and will be true iff both p and q are true.

Notes prepared by Peninah J. Limo Page 22


Let us write T for truth, and F for falsity. Then the truth table for P ^ Q is:
P Q P^Q

F F F

F T F

T F F

T T T

(ii) OR
Any two propositions can be combined by the word ‘or’ to form a third proposition called the
disjunction of the originals.
Definition: If p and q are arbitrary propositions, then the disjunction of P and Q is written
P∨Q and will be true iff either P is true, or Q is true, or both P and Q are true.
The operation of ∨ is summarised in the following truth table:

P Q P ∨ Q

F F F

F T T

T F T

T T T

(iii) IF THEN
Many statements, particularly in mathematics, are of the form:
if P is true then Q is true.
Another way of saying the same thing is to write:
P implies Q.
In propositional logic, we have a connective that combines two propositions into a new
proposition called the conditional, or implication of the originals, that attempts to capture the
sense of such a statement.
Definition: If P and Q are arbitrary propositions, then the conditional of p and q is written:
P→Q and will be true iff either P is false or Q is true.

Notes prepared by Peninah J. Limo Page 23


The truth table for → is:

P Q P→Q

F F T

F T T

T F F

T T T

(iv) IF AND ONLY IF(iff)


Another common form of statement in maths is:
P is true if, and only if, Q is true.
The sense of such statements is captured using the biconditional operator.
Definition: If p and q are arbitrary propositions, then the biconditional of p and q is written:
P↔Q and will be true iff either P and Q are both true; or P and Q are both false.
The truth table for ↔ is:
P Q P ↔Q

F F T

F T F

T F F

T T T

If p ↔ q is true, then p and q are said to be logically equivalent. They will be true under exactly
the same circumstances.

(v) NOT
All of the connectives we have considered so far have been binary: they have taken two
variables. The final connective we consider here is unary. It only takes one variables. Any
proposition can be prefixed by the word ‘not’ to form a second proposition called the negation of
the original.
Definition: If p is an arbitrary proposition then the negation of p is written;

Notes prepared by Peninah J. Limo Page 24


¬P and will be true iff P is false.
Truth table for ¬:

P ¬P

F T

T F

FORMULA
More complex sentences are formed using connectives. Sentences formed in this way can be
called Well-Formed Formula (WFF). Parentheses can be used to indicate precedence.
If p; q; r; s and t are atomic propositions, then all of the following are formulae:
P^Q→R
P ^ (Q → R)
(P ^ (Q → R)) ∨ S
((P ^ (Q → R)) ∨ S) ^ T
whereas none of the following is:
P^
P ^ Q)
P¬
Complex sentences evaluate to true or false.
 A formula is a tautology iff it is true under every valuation;
 A formula is consistent iff it is true under at least one valuation;
 A formula is inconsistent iff it is not made true under any valuation.

Further study(homework)
1. Make short notes on clause and clausal notation
2. Resolution and prove using resolution

(b) PREDICATE LOGIC/FIRST ORDER LOGIC


Predicate Logic also called first order logic is an extension and generalization of propositional
calculus which provides more power and efficiency for making logical inferences. Propositional
logic deals only with the truth value of complete statements and does not consider relationships

Notes prepared by Peninah J. Limo Page 25


or dependencies between objects. Predicate logic has three more logical notions as compared to
Predicate Logic: Terms, Predicates and Quantifiers.
First-order logic is symbolized reasoning in which each sentence, or statement, is broken
down into a terms (subject) and a predicate. The predicate modifies or defines the properties of
the term/subject. In first-order logic, a predicate can only refer to a single term/subject.

A sentence in first-order logic is written in the form Px or P(x), where P is the predicate and x is
the term/subject, represented as a variable. e.g Red(car23), student(x), married(John,Ann)

Example

1. “peter is a man”, “paul is a man”, “john is a man”

Represented as man(peter), man(paul) and man(john).

2. “spot is a dog” is represented as: dog(spot)


3. “Elephants are animals” is represented as: Animals (elephants)
4. “A likes fruit “ is representes as: likes (A, fruit)
5. “x loves y” is represented as: loves(x, y)
6. Students like AI is representes as: like(students, AI)

Basic FOL elements:


1. Constants: models a specific object
Examples: “John”, “France”, “7” KingJohn, 2, UNIBI,...
2. Predicates: over one, two or many variables or constants.– Represents properties or relations
among objects
Examples: Brother, Sister, Mother , Father
3. Functions : They refer to a specific object. We can use functions to symbolically refer to
objects without naming them.
Examples:
fatherof(x), age(x) , times(x,y), succ(x)

“john’s father loves john” is represented as


LOVE(father(john), john). - Here father is a function that maps john to his father.

4. Variables : represents object of specific type (defined by the universe of discourse)


Examples: x, y, x, a, b,...
(universe of discourse can be people, students, numbers)
Notes prepared by Peninah J. Limo Page 26
5. Connectives: ¬, ⇒, ∧ , ∨ , ⇔
• Equality: =
6. Quantifiers(∀ , ∃ ): There two types of quantifiers Univeral quantifiers and Existential
Quantifiers
Universal Quantification allows us to make a statement about a collection of objects:
Universal quantification takes the format :
∀ x: a. p read “for all x in a, p holds” where:
a - is universe of discourse
x - is a member of the domain of discourse
p - is a statement about x

Existential Quantification allows us to state that an object does exist (without naming it):
Existential quantification takes the format ∃x: a. p read “there exist an x such that p holds”
where:

a - is universe of discourse
x - is a member of the domain of discourse
p - is a statement about x

Examples of using universal quantifier


Examples 1

All birds fly.


In this question the predicate is "fly(bird)."
And since there are all birds who fly so it will be represented as follows.
∀x: bird(x) →fly(x).

Example 2

Every man respects his parent.


In this question, the predicate is "respect(x, y)," where x=man, and y= parent.
Since there is every man so will use ∀, and it will be represented as follows:
∀x: man(x) → respects (x, parent).

Example 3

Not all students like both Mathematics and Science.


In this question, the predicate is "like(x, y)," where x= student, and y= subject.

Notes prepared by Peninah J. Limo Page 27


Since there are not all students, so we will use ∀ with negation, so following representation for
this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].

Example 4
Every man is mortal
Representation of statement in predicate form
− “x is a man” and “man(x),
− x is mortal” by mortal(x)
Every man is mortal :
x: man(x)  mortal(x)

Further examples

 All cats are mammels - ∀x: Cat(x) ⇒ Mammel(x)


 All dogs have tails - ∀x :dog(x) ⇒ hastail(x)
 Every elephant is grey - ∀x :elephant(x) grey(x)
 All purple mushrooms are poisonous - ∀x :mushroom(x) ∧ purple(x) poisonous(x)
 All animals either live on land or in water - ∀x: animal(x) ⇒ live(x,land) ∨ live(x,water)
 All animals eat fruit or meat - ∀ (x) : animal (x) ⇒eat (x, fruit) ∨ eat (x, meat)
 All of Bill’s kids are also Hillary’s kids - ∀ x: Father(Bill,x) ⇒Mother(Hillary,x)

Examples of using Existential quantifier


Example 1

Some boys play cricket.


In this question, the predicate is "play(x, y)," where x= boys, and y= game. Since there are some
boys so we will use ∃, and it will be represented as:
∃x: boys(x) → play(x, cricket).

Further examples

 There is a mean cat - ∃ x: Cat(x) ∧ Mean(x)


 There is a kid whose father is Bill and whose mother is Hillary
∃x: Father(Bill,x) ∧ Mother(Hillary,x)
 The cat sat on the mat - ∃x∃y(Cat(x)∧Mat(y)∧SatOn(x,y))

Notes prepared by Peninah J. Limo Page 28


Examples of Existential and universal quantifier
Example 1
Only one student failed in Mathematics.
In this question, the predicate is "failed(x, y)," where x= student, and y= subject.
Since there is only one student who failed in Mathematics, so we will use following
representation for this:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed
(x, Mathematics)].

Examples 2
All animals eat the food they like
solution
 (x) ∃ (y): animal(x) ∧ food(y) ∧ like(x,y) eat(x,y)

Properties of Quantifiers:

1. Quantifiers of same type commute


 ∀x∀y is similar to ∀y∀x.
 ∃x∃y is similar to ∃y∃x.
2. Quantifiers of different type do NOT commute
 ∃x∀y is not similar to ∀y∃x.

Example 1

∃x∀yLoves(x, y)

“There is a person who loves everyone in the world”

∀y∃xLoves(x, y)

“Everyone in the world is loved by at least one person”

(Both hopefully true but different)


Example 2
∀x∃yMother(x, y)
Everyone has a mother” (correct)

Notes prepared by Peninah J. Limo Page 29


∃y∀xMother(x, y)
“There is a person who is the mother of everyone” (wrong)
Advantages
1. First-order logic is more expressive than propositional logic, allowing for the representation
of complex concepts and relationship.
2. First-order is also more efficient than proposition logic in many cases due to its ability to
make use of variables and quantifiers.
3. First-order logic has well-defined semantics, which makes it easier to reason about and work
with than other formalism.
Disadvantages
1. First-order logic is more difficult to learn and use than propositional logic due to its greater
complexity.
2. First-order logic is also less tractable than propositional logic in many cases, due to the need
to reason about quantifiers and variables.
3. First-order logic can be difficult to apply in practice, due to the need to find appropriate
axioms and rules for each application

Notes prepared by Peninah J. Limo Page 30

You might also like