Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

AI Propositional Predicate Logic

The document discusses knowledge representation techniques in artificial intelligence, focusing on propositional logic and predicate logic. Propositional logic involves simple declarative statements that can be true or false, while predicate logic extends this to express more complex relationships and quantifications. Key concepts include logical connectives, truth tables, and the limitations of propositional logic, necessitating the use of predicate logic for more expressive representation.

Uploaded by

Tanya Verma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

AI Propositional Predicate Logic

The document discusses knowledge representation techniques in artificial intelligence, focusing on propositional logic and predicate logic. Propositional logic involves simple declarative statements that can be true or false, while predicate logic extends this to express more complex relationships and quantifications. Key concepts include logical connectives, truth tables, and the limitations of propositional logic, necessitating the use of predicate logic for more expressive representation.

Uploaded by

Tanya Verma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 40

Knowledge Representation Technique

Propositional logic in Artificial intelligence


Logic can be defined as scientific study of
the process of reasoning and the system of
rules and procedures that help in the
reasoning process.
1. Propositional Logic
2. Predicate Logic
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.
Example:
a)A= It is Sunday.
b) The Sun rises from West (False proposition)
c) 3+3= 7(False proposition)
d) 5 is a prime number.
Following are some basic facts about propositional
logic:
o Propositional logic is also called Boolean logic as
it works on 0 and 1.
o In propositional logic, we use symbolic variables
to represent the logic, and we can use any
symbol for a representing a proposition, such A,
B, C, P, Q, R, etc.
o Propositions can be either true or false, but it
cannot be both.
o Propositional logic consists of an object,
relations or function, and logical connectives.
o These connectives are also called logical
operators.
o The propositions and connectives are the basic
elements of the propositional logic.
o Connectives can be said as a logical operator
which connects two sentences.
o A proposition formula which is always true is
called tautology, and it is also called a valid
sentence.
o A proposition formula which is always false is
called Contradiction.
o A proposition formula which has both true and
false values is called Contingent
o Statements which are questions, commands, or
opinions are not propositions such as "Where is
Rohini", "How are you", "What is your name",
are not propositions.
Syntax of propositional logic:
The syntax of propositional logic defines the allowable
sentences for the knowledge representation. There are
two types of Propositions:
a. Atomic Propositions
b.Compound/Molecular propositions

o Atomic Proposition: Atomic propositions are the


simple propositions. It consists of a single
proposition symbol. These are the sentences
which must be either true or false.
Example:
1. a) 2+2 is 4, it is an atomic proposition as it is a true fact
.
2. b) "The Sun is cold" is also a proposition as it is a false
fact.
o Compound proposition: Compound propositions

are constructed by combining simpler or atomic


propositions, using parenthesis and logical
connectives.
Example:
a) "It is raining today and the street is wet."
b) "Ankit is a doctor and his clinic is in Mumbai."
Logical Connectives:
Logical connectives are used to connect two simpler
propositions or representing a sentence logically. We
can create compound propositions with the help of
logical connectives. There are mainly five connectives,
which are given as follows:
1. Negation: A sentence such as ¬ P or ~P is called
negation of P. A literal can be either Positive literal or
negative literal.
2. Conjunction: A sentence which has ∧ connective
such as, P ∧ Q or P&Q is called a Conjunction.
Example: Rohan is intelligent and hardworking. It
can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.
3. Disjunction or Inclusive Disjunction: A sentence
which has ∨ connective, such as P ∨ Q. is called
disjunction, where P and Q are the propositions.
Example: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is Engineer, so we
can write it as P ∨ Q.
4. Implication: A sentence such as P → Q, is called an
implication. Implications are also known as if-then
rules. It can be represented as
If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is
represented as P → Q
5. Biconditional/double implication/material
biconditional : A sentence such as P⇔ Q is a
Biconditional sentence, example If I am breathing,
then I am alive
P= I am breathing, Q= I am alive, it can be
represented as P ⇔ Q.

Following is the summarized table for Propositional


Logic Connectives:

Truth Table:
In propositional logic, we need to know the truth
values of propositions in all possible scenarios. We can
combine all the possible combination with logical
connectives, and the representation of these
combinations in a tabular format is called Truth table.
Following are the truth table for all logical connectives:
Truth table with three propositions:
We can build a proposition composing three
propositions P, Q, and R. This truth table is made-up of
8n Tuples as we have taken three proposition symbols.

Precedence of connectives:
Just like arithmetic operators, there is a precedence
order for propositional connectors or logical operators.
This order should be followed while evaluating a
propositional problem. Following is the list of the
precedence order for operators:
Precedence Operators

First Precedence Parenthesis

Second Precedence Negation

Third Precedence Conjunction(AND)

Fourth Precedence Disjunction(OR)

Fifth Precedence Implication

Six Precedence Biconditional

Note: For better understanding use parenthesis to


make sure of the correct interpretations. Such as ¬R∨
Q, It can be interpreted as (¬R) ∨ Q.

Logical equivalence:
Logical equivalence is one of the features of
propositional logic. Two propositions are said to be
logically equivalent if and only if the columns in the
truth table are identical to each other.
Let's take two propositions A and B, so for logical
equivalence, we can write it as A⇔B. In below truth
table we can see that column for ¬A∨ B and A→B, are
identical hence A is Equivalent to B
Properties of Operators:
o Commutativity:
o P∧ Q= Q ∧ P, or

o P ∨ Q = Q ∨ P.

o Associativity:
o (P ∧ Q) ∧ R= P ∧ (Q ∧ R),

o (P ∨ Q) ∨ R= P ∨ (Q ∨ R)

o Identity element:
o P ∧ True = P,

o P ∨ True= True.

o Distributive:
o P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).

o P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).

o DE Morgan's Law:
o ¬ (P ∧ Q) = (¬P) ∨ (¬Q)

o ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).

o Double-negation elimination:
o ¬ (¬P) = P.
Limitations of Propositional logic:
o We cannot represent relations like ALL, some, or
none with propositional logic. Example:
0. All the girls are intelligent.
a. Some apples are sweet.
o Propositional logic has limited expressive power.
o In propositional logic, we cannot describe
statements in terms of their properties or logical
relationships.
Predicate Logic or First Order Logic (FOL) or
Mathematics logic
In the topic of Propositional logic, we have seen that
how to represent statements using propositional logic.
But unfortunately, in propositional logic, we can only
represent the facts, which are either true or false. PL is
not sufficient to represent the complex sentences or
natural language statements. The propositional logic
has very limited expressive power. Consider the
following sentence, which we cannot represent using
PL logic.
o "Some humans are intelligent", or
o "Sachin likes cricket."
To represent the above statements, PL logic is not
sufficient, so we required some more powerful logic,
such as first-order logic.
Consider the following example. We need to convert
the following sentence into a mathematical statement
using propositional logic only.
"Every person who is 18 years or older, is eligible to
vote."
The above statement cannot be adequately expressed
using only propositional logic. The problem in trying to
do so is that propositional logic is not expressive
enough to deal with quantified variables. It would have
been easier if the statement were referring to a
specific person. But since it is not the case and the
statement applies to all people who are 18 years or
older, we are stuck.
Therefore we need a more powerful type of logic.
Predicate Logic or First-Order logic:
o First-order logic is another way of knowledge

representation in artificial intelligence. It is an


extension to propositional logic.
o FOL is sufficiently expressive to represent the
natural language statements in a concise way.
o First-order logic is also known as Predicate logic or
First-order predicate logic.
o First-order logic is a powerful language that
develops information about the objects in a more
easy way and can also express the relationship
between those objects.
o First-order logic (like natural language) does not
only assume that the world contains facts like
propositional logic but also assumes the following
things in the world:
o Objects: A, B, people, numbers, colors, wars,

theories, squares
o Relations: It can be unary relation such

as: red, round, is adjacent, or n-any relation


such as: the sister of, brother of, has color,
comes between
o Function: Father of, best friend, third inning

of, end of,.....


o It adds the concept of predicates and quantifiers
to better capture the meaning of statements
o As a natural language, first-order logic also has two
main parts:
0. Syntax
a. Semantics
Basic Elements of First-order logic:
Following are the basic elements of FOL syntax:

Constant 1, 2, A, John, Mumbai, cat,....

Variables x, y, z, a, b,....

Predicates Brother, Father, >,....

Function sqrt, LeftLegOf, ....

Connectives ∧, ∨, ¬, ⇒, ⇔

Equality ==

Quantifier ∀, ∃

Atomic sentences:
o Atomic sentences are the most basic sentences of
first-order logic. These sentences are formed from
a predicate symbol followed by a parenthesis with
a sequence of terms.
o We can represent atomic sentences as Predicate
(term1, term2, ......, term n).
Example: Ravi and Ajay are brothers: =>
Brothers (Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
Complex Sentences:
o Complex sentences are made by combining atomic
sentences using connectives.
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.
Consider the statement, “x is greater than 3″. It has
two parts. The first part, the variable x, is the subject of
the statement. The second part, “is greater than 3”, is
the predicate. It refers to a property that the subject of
the statement can have.
The statement “ x is greater than 3″ can be denoted
by P(x) where P denotes the predicate “is greater than
3” and x is the variable.
The following are some examples of predicates.
o Consider E(x, y) denote "x = y"

o Consider X(a, b, c) denote "a + b + c = 0"

o Consider M(x, y) denote "x is married to y."

Quantifiers in First-order logic:


o A quantifier is a language element which
generates quantification, and quantification
specifies the quantity of specimen in the universe
of discourse.
o These are the symbols that permit to determine or
identify the range and scope of the variable in the
logical expression. There are two types of
quantifier:
0. Universal Quantifier, (for all, everyone,
everything)
a. Existential quantifier, (for some, at least
one).
Universal Quantifier:
Universal quantifier is a symbol of logical
representation, which specifies that the statement
within its range is true for everything or every instance
of a particular thing.
The Universal quantifier is represented by a symbol ∀,
which resembles an inverted A.
Note: In universal quantifier we use implication "→".
If x is a variable, then ∀x is read as:
o For all x
o For each x
o For every x.
Example:
All man drink coffee.
Let a variable x which refers to a cat so all x can be
represented in UOD as below:
∀x: man(x) → drink (x, coffee).
It will be read as: for all x where x is a man who drink
coffee.

Existential Quantifier:
Existential quantifiers are the type of quantifiers, which
express that the statement within its scope is true for
at least one instance of something.
It is denoted by the logical operator ∃, which
resembles as inverted E. When it is used with a
predicate variable then it is called as an existential
quantifier.
Note: In Existential quantifier we always use AND or
Conjunction symbol (∧).
If x is a variable, then existential quantifier will be ∃x or
∃(x). And it will be read as:
o There exists a 'x.'
o For some 'x.'
o For at least one 'x.'
Example:
Some boys are intelligent.
∃x: boys(x) ∧ intelligent(x)
It will be read as: There are some x where x is a boy
who is intelligent.
Points to remember:
o The main connective for universal quantifier ∀ is
implication →.
o The main connective for existential quantifier ∃ is
and ∧.
Properties of Quantifiers:
o In universal quantifier, ∀x∀y is similar to ∀y∀x.
o In Existential quantifier, ∃x∃y is similar to ∃y∃x.
o ∃x∀y is not similar to ∀y∃x.
Some Examples of FOL using quantifier:
1. All birds fly.
In this question the predicate is "fly (bird)."
And since there are all birds that fly so it will be
represented as follows.
∀x: bird(x) →fly(x).
For all x such that x is a bird it implies that birds fly
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).
3. 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).
4. Not all students like both Mathematics and Science.
In this question, the predicate is "like(x, y)," where x=
student, and y= subject.
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))
Free and Bound Variables:
The quantifiers interact with variables which appear in
a suitable way. There are two types of variables in
First-order logic which are given below:
Free Variable: A variable is said to be a free variable in
a formula if it occurs outside the scope of the
quantifier.
Example: ∀x ∃y [P (x, y, z)], where z is a free
variable.
Bound Variable: A variable is said to be a bound
variable in a formula if it occurs within the scope of the
quantifier.
Example: ∀x [A (x) B( y)], here x and y are the
bound variables.
Inference:
In artificial intelligence, we need intelligent computers which can
create new logic from old logic or by evidence, so generating the
conclusions from evidence and facts is termed as Inference.
Inference rules:
Inference rules are the templates for generating valid arguments.
Inference rules are applied to derive proofs in artificial intelligence,
and the proof is a sequence of the conclusion that leads to the desired
goal.
In inference rules, the implication among all the connectives plays an
important role. Following are some terminologies related to inference
rules:
o Implication:

o Converse:

o Contrapositive:

o Inverse:

From the above term some of the compound statements are equivalent
to each other, which we can prove using truth table:

Hence from the above truth table, we can prove that P Q is equivalent to ¬ Q ¬ P

Types of Inference rules:

1. Modus Ponens:

The Modus Ponens rule is one of the most important rules of inference, and it stat

Example:
Statement-1: "If I am sleepy then I go to bed" ==> P Q

Proof by Truth table:

2. Modus Tollens:

The Modus Tollens rule state that if P Q is true and ¬ Q is true,


then ¬ P will also true. It can be represented as:

Statement-1:
Statement-2: "I do not go to the bed."==> ~Q
Statement-3: Which infers that "I am not sleepy" => ~P
Proof by Truth table:

3. Hypothetical Syllogism:

The Hypothetical Syllogism rule state that if PR is true whenever PQ is true, and Q
Example:
Statement-1: If you have my home key then you can unlock my
home. PQ
Statement-2: If you can unlock my home then you can take my
money. QR
Conclusion: If you have my home key then you can take my
money. PR
Proof by truth table:

4. Disjunctive Syllogism:

The Disjunctive syllogism rule state that if P∨Q is true, and ¬P is true,
then Q will be true. It can be represented as:

Example:
Statement-1: Today is Sunday or Monday. ==>P∨Q
Statement-2: Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q
Proof by truth-table:
5. Addition:

The Addition rule is one the common inference rule, and it states that
If P is true, then P∨Q will be true.

Example:
Statement: I have a vanilla ice-cream. ==> P
Statement-2: I have Chocolate ice-cream.
Conclusion: I have vanilla or chocolate ice-cream. ==> (P∨Q)
Proof by Truth-Table:

6. Simplification:

The simplification rule state that if P∧ Q is true, then Q or P will also


be true. It can be represented as:

Proof by Truth-Table:

7. Resolution:
The Resolution rule state that if P∨Q and ¬ P∧R is true, then Q∨R
will also be true. It can be represented as

Proof by Truth-Table:

You might also like