Unit 1
Topic : Using Predicate Logic and Representing Knowledge as Rules, Representing
simple facts in logic, Computable functions and predicates
Predicate
Logic in AI:
Introduction
• Predicate Logic or First-
Order Logic (FOL) is used to
represent complex
expressions in easier forms
using predicates, variables,
and quantifiers. The real-
world facts can be simply
represented as local
propositions written as well-
formed formulas in
propositional logic.
• Statement
All white birds are beautiful.
• Predicates
• IsWhite(x): Represents
the property that x is
white.
• IsBeautiful(x): Repres
ents the property that
x is beautiful.
• Expression
• ∀ x ( IsWhite(x) →
IsBeautiful(x) )
Compone
nts of
Predicate
Logic
The three components of Predicate logic are:
• Predicates
• Variables
• Quantifiers
Predicates
• The symbols which are used to represent the properties
or relationships or conditions between real-world objects
are called Predicates.
• Predicates are functions that take one or more variables as arguments and return a
truth value (true or false)
For example, predicates like isLocatedIn(Delhi,
India) are used to represent the information.
• "IsPrime(x)" could be a predicate that checks if a number x is prime.
Variables
• The symbols used to represent the objects or entities are
called Variables. They are used to quantify the objects by
providing them with a symbol and passing it to predicates.
• variables are used as placeholders within predicates.
For example, in the above example isLocatedIn(Delhi,
India), the variables are Delhi and India.
• in the predicate "IsPrime(x)," 'x' is a variable that can represent any number.
Quantifiers
• The symbols in logical statements that are used to represent the
scope of variables are called Quantifiers. They are used to
represent the relationships between objects and properties.
The two main quantifiers are
• Universal Quantifier ( )
∀ Denotes that a statement is true for all values of a variable
within a given domain. For example, " x IsPrime(x)" means “x is prime for all values of x"
∀
• Existential Quantifier ( ).
∃ Denotes that a statement is true for at least one value of a
variable within a given domain. For example, " x IsPrime(x)" means "there exists a value of x that is
∃
prime."
Logical Operators:
• Logical operators, such as "AND," "OR," "NOT," and
"IMPLIES," are used to combine and manipulate
predicates and logical expressions. These operators
determine the truth value of compound statements.
Characteristics of
Predicate Logic
• The Predicate Logic makes the representation of complex relationships simpler by
representing them using the symbols like Predicates and Variables.
• Predicate Logic is used to represent many complex relationships. It can represent
negation, conjunction, disjunction, and many more types of statements.
• Predicate Logic consists of well-defined rules and proper syntax to represent the
relationships via valid logical expressions.
• Predicate Logic is used widely in the field of Artificial Intelligence because of its
capability to represent facts and relationships in a structured manner.
Representing simple facts in logic
• Converting facts to logical propositions The first step is to convert facts in English to
logical propositions called well-formed formulas (wffs).
• The wffs include the following symbols:
• Implies: →
• And: /
• Or: /
• Not: ~
• For all: ∀
• The exists: ∃
Example: Consider the following facts on
Italian history:
• 1. Marcus was a man.
• 2. Marcus was a Pompeian.
• 3. All Pompeians were Roman.
• 4. Caesar was a ruler.
• 5. All Romans were either loyal to Caesar or hated
him.
• 6. Everyone is loyal to someone.
• 7. People only try to assassinate rulers that they are
not loyal to.
• 8. Marcus tried to assassinate Caesar.
• 9. All men are people.
• 1. man(Marcus)
• 2. Pompeian(Marcus)
• 3. x: Pompeian(x) → Roman(x)
∀
• 4. ruler(Caesar)
• 5. x: Roman(x) → loyalto(x,Caesar) / hate(x,Caesar)
∀
• 6. x y: loyalto(x,y)
∀ ∃
• 7. x y: person(x) / ruler(y) / tryassassinate(x,y) →
∀ ∀
~loyalto(x,y)
• 8. tryassassinate(Marcus,Caesar)
• 9. x: man(x) → person(x)
∀
Computable
Functions
and
Predicates
• It may be necessary to compute functions as part
of a fact. In these cases a computable predicate is
used. A computable predicate may include
computable functions such as +, -, *, etc. For
example, gt(x-y,10) →bigger(x) contains the
computable predicate gt which performs the
greater than function. Note that this computable
predicate uses the computable function
subtraction.
Example: Consider the following statements
• 1. Marcus was a man.
• 2. Marcus was Pompeian.
• 3. Marcus was born in 40 A.D.
• 4. All men are mortal.
• 5. All Pompeians died when the volcano
erupted in 79 A.D.
• 6. No mortal lives longer than 150 years.
• 7. It is now 1991.
• 8. Alive means not dead.
• 9. If someone dies, he is dead at all later times.
• 1. man(Marcus)
• 2. Pompeian(Marcus)
• 3. born(Marcus,40)
• 4. x: man(x) → mortal(x)
∀
• 5. erupted(volcano,79) / x: Pompeian(x) → died(x,79)
∀
• 6. x t1 t2: mortal(x) / born(x,t1) / gt(t2-t1,150) →
∀ ∀ ∀
dead(x,t2)
• 7. now=1991
• 8. x t: [alive(x,t) → ~dead(x,t)] / [~dead(x,t) →alive(x,t)]
∀ ∀
• 9. x t1 t2:died(x,t1) / gt(t2,t1) →dead(x,t2)
∀ ∀ ∀

AIML_U1_L1 (1).pptxAIML_U1_L1 (1).pptxAIML_U1_L1 (1).pptx

  • 1.
    Unit 1 Topic :Using Predicate Logic and Representing Knowledge as Rules, Representing simple facts in logic, Computable functions and predicates
  • 2.
    Predicate Logic in AI: Introduction •Predicate Logic or First- Order Logic (FOL) is used to represent complex expressions in easier forms using predicates, variables, and quantifiers. The real- world facts can be simply represented as local propositions written as well- formed formulas in propositional logic. • Statement All white birds are beautiful. • Predicates • IsWhite(x): Represents the property that x is white. • IsBeautiful(x): Repres ents the property that x is beautiful. • Expression • ∀ x ( IsWhite(x) → IsBeautiful(x) )
  • 3.
    Compone nts of Predicate Logic The threecomponents of Predicate logic are: • Predicates • Variables • Quantifiers
  • 4.
    Predicates • The symbolswhich are used to represent the properties or relationships or conditions between real-world objects are called Predicates. • Predicates are functions that take one or more variables as arguments and return a truth value (true or false) For example, predicates like isLocatedIn(Delhi, India) are used to represent the information. • "IsPrime(x)" could be a predicate that checks if a number x is prime.
  • 5.
    Variables • The symbolsused to represent the objects or entities are called Variables. They are used to quantify the objects by providing them with a symbol and passing it to predicates. • variables are used as placeholders within predicates. For example, in the above example isLocatedIn(Delhi, India), the variables are Delhi and India. • in the predicate "IsPrime(x)," 'x' is a variable that can represent any number.
  • 6.
    Quantifiers • The symbolsin logical statements that are used to represent the scope of variables are called Quantifiers. They are used to represent the relationships between objects and properties. The two main quantifiers are • Universal Quantifier ( ) ∀ Denotes that a statement is true for all values of a variable within a given domain. For example, " x IsPrime(x)" means “x is prime for all values of x" ∀ • Existential Quantifier ( ). ∃ Denotes that a statement is true for at least one value of a variable within a given domain. For example, " x IsPrime(x)" means "there exists a value of x that is ∃ prime."
  • 7.
    Logical Operators: • Logicaloperators, such as "AND," "OR," "NOT," and "IMPLIES," are used to combine and manipulate predicates and logical expressions. These operators determine the truth value of compound statements.
  • 8.
    Characteristics of Predicate Logic •The Predicate Logic makes the representation of complex relationships simpler by representing them using the symbols like Predicates and Variables. • Predicate Logic is used to represent many complex relationships. It can represent negation, conjunction, disjunction, and many more types of statements. • Predicate Logic consists of well-defined rules and proper syntax to represent the relationships via valid logical expressions. • Predicate Logic is used widely in the field of Artificial Intelligence because of its capability to represent facts and relationships in a structured manner.
  • 9.
    Representing simple factsin logic • Converting facts to logical propositions The first step is to convert facts in English to logical propositions called well-formed formulas (wffs). • The wffs include the following symbols: • Implies: → • And: / • Or: / • Not: ~ • For all: ∀ • The exists: ∃
  • 10.
    Example: Consider thefollowing facts on Italian history: • 1. Marcus was a man. • 2. Marcus was a Pompeian. • 3. All Pompeians were Roman. • 4. Caesar was a ruler. • 5. All Romans were either loyal to Caesar or hated him. • 6. Everyone is loyal to someone. • 7. People only try to assassinate rulers that they are not loyal to. • 8. Marcus tried to assassinate Caesar. • 9. All men are people. • 1. man(Marcus) • 2. Pompeian(Marcus) • 3. x: Pompeian(x) → Roman(x) ∀ • 4. ruler(Caesar) • 5. x: Roman(x) → loyalto(x,Caesar) / hate(x,Caesar) ∀ • 6. x y: loyalto(x,y) ∀ ∃ • 7. x y: person(x) / ruler(y) / tryassassinate(x,y) → ∀ ∀ ~loyalto(x,y) • 8. tryassassinate(Marcus,Caesar) • 9. x: man(x) → person(x) ∀
  • 11.
    Computable Functions and Predicates • It maybe necessary to compute functions as part of a fact. In these cases a computable predicate is used. A computable predicate may include computable functions such as +, -, *, etc. For example, gt(x-y,10) →bigger(x) contains the computable predicate gt which performs the greater than function. Note that this computable predicate uses the computable function subtraction.
  • 12.
    Example: Consider thefollowing statements • 1. Marcus was a man. • 2. Marcus was Pompeian. • 3. Marcus was born in 40 A.D. • 4. All men are mortal. • 5. All Pompeians died when the volcano erupted in 79 A.D. • 6. No mortal lives longer than 150 years. • 7. It is now 1991. • 8. Alive means not dead. • 9. If someone dies, he is dead at all later times. • 1. man(Marcus) • 2. Pompeian(Marcus) • 3. born(Marcus,40) • 4. x: man(x) → mortal(x) ∀ • 5. erupted(volcano,79) / x: Pompeian(x) → died(x,79) ∀ • 6. x t1 t2: mortal(x) / born(x,t1) / gt(t2-t1,150) → ∀ ∀ ∀ dead(x,t2) • 7. now=1991 • 8. x t: [alive(x,t) → ~dead(x,t)] / [~dead(x,t) →alive(x,t)] ∀ ∀ • 9. x t1 t2:died(x,t1) / gt(t2,t1) →dead(x,t2) ∀ ∀ ∀

Editor's Notes

  • #2 https://www.codingninjas.com/studio/library/predicate-logic-in-ai Example of Predicate Logic Let's see a simple example to understand Predicate Logic in a much better way. Suppose we are given the following statement. Explanation   The statement  ∀ x (IsWhite(x) → IsBeautiful(x)) can be read as "For all x, if x is white, then x is beautiful". The universal quantifier ( ∀ ) indicates that the statement applies to all objects (birds) in the domain. The implication (→) connects the properties "IsWhite(x)" and "IsBeautiful(x)," stating that if an object x is white, then it is also beautiful.
  • #3 https://www.codingninjas.com/studio/library/predicate-logic-in-ai
  • #4 https://www.codingninjas.com/studio/library/predicate-logic-in-ai
  • #5 https://www.codingninjas.com/studio/library/predicate-logic-in-ai
  • #6 https://www.codingninjas.com/studio/library/predicate-logic-in-ai
  • #7 https://www.codingninjas.com/studio/library/predicate-logic-in-ai
  • #8 https://www.codingninjas.com/studio/library/predicate-logic-in-ai
  • #10 https://gascmlmd.in/notes/ai.pdf
  • #11 https://www.codingninjas.com/studio/library/predicate-logic-in-ai
  • #12 https://www.codingninjas.com/studio/library/predicate-logic-in-ai