SlideShare a Scribd company logo
1 of 32
Obour Institute
Lec_4, 5
Logic-based Knowledge Representation
Logic-based Knowledge Representation
• Different types of logic that can be used to represent knowledge are:
• Propositional calculus (or logic) PL.
• predicate calculus (or logic) some times called First order logic (FOL).
• Logic or belief.
• Logic can be defined as the study of correct inference, i.e. what follows from what.
2
Logic-based Knowledge Representation
• Logic usually consists of syntax, semantics and a proof theory.
• The syntax of logic defines a formal language of the logic.
• The semantics of logic specifies the meanings of the well-formed expressions of
the logical language.
• Semantics is the study of meaning
• The proof theory of logic provides a purely formal specification of the notion of
correct inference.
• This chapter introduces the propositional calculus and the predicate calculus as logic-
based knowledge representation languages for AI.
3
The Propositional Calculus
1) The syntax of the propositional calculus:
The first step in describing a language is to introduce its set of symbols.
 Propositional calculus symbols are:
 the propositional symbols: P, Q, R, S, … (uppercase letters near the end of the
English alphabet)
 truth symbols or logical constants: true, false
 Logical connectives: , , ‫ר‬, , 
 Propositional symbols denote propositions, or statements about the world that may be
either true or false, such as "the car is red".
4
Rules of forming legal propositional calculus sentences:
1. Every single propositional symbol and truth symbol is called atomic sentence.
e.g. true, P, Q, and R are sentences.
2. The negation of atomic sentence is a complex sentence.
e.g. ‫ר‬P and ‫ר‬false are complex sentences.
3. The conjunction, i.e. and, of two atomic sentence is a complex sentence.
e.g. P  Q is a complex sentence.
4. The disjunction, i.e. or, of two atomic sentence is a complex sentence.
e.g. P  Q is a complex sentence.
5. The implication of one sentence from another is a complex sentence.
e.g. P  Q is a complex sentence.
6. The equivalence of two atomic or complex sentence is a complex sentence.
e.g. P  Q  R is a complex sentence.
• Legal sentences are also called well-formed formulas or WFFs.
5
6
 In P  Q, is pronounced P and Q, P and Q are called conjuncts.
 In P  Q, is pronounced P or Q, P and Q are called disjuncts.
 In P  Q, P is the premise and Q is the conclusion.
• It means P implies Q. If the implication is true when the
premise is true, the conclusion must also be true.
• Ex: if it rainy, the earth would be wet
@Sinaiunieg www.su.edu.eg
info@su.edu.eg
Rules of forming legal propositional
calculus sentences:
 The semantics of propositional calculus is defined as follows:
 Semantics of PL is the interpretation of the propositional symbols (P, Q, R,…) and
logical constants (true, false) and specifying the meaning of the logical connectors (‫ר‬,
, , , ).
 An interpretation of a set of propositions is the assignment of a truth value, either T or
F, to each propositional symbol.
 Formally, an interpretation is a mapping from the propositional symbols into the set
{T, F}.
 A propositional symbol corresponds to a statement about the world.
 EX:- P may denote the statement “it is raining” or “Paris is the capital of France”.
 Note that, the symbols true and false (logical constants) are part of the set of well-
formed sentences of the propositional calculus; i.e. they are distinct from the truth
value, T/F, assigned to a sentence.
7
Rules of forming legal propositional calculus sentences:
2) The semantics of the propositional calculus:
 Where we have only two truth values (i.e. T or F) as an interpretation
for each propositional symbol, then if we have n propositional symbols,
we can define 𝟐𝒏 different interpretations.
 For example, if P denotes the proposition "it is raining" and Q denotes "I am at
work", then the set of propositions {P, Q} has different functional mapping into
the truth values {T, F}. These mappings correspond to 4 different
interpretations.
8
Rules of forming legal propositional
calculus sentences:
The interpretation or truth value assignment for sentences is determined as follows:
Condition
Truth value assignment
Sentence
T
true
F
false
If P has truth value F.
If P has truth value T.
T
F
‫ר‬P
If both P and Q has truth value T.
Otherwise.
T
F
P  Q
If both P and Q has truth value F.
Otherwise.
F
T
P  Q
If P is T and Q is F.
Otherwise.
F
T
P  Q
If P and Q have the same truth value
assignments for all possible
interpretations.
Otherwise.
T
F
P  Q
9
• The truth assignments of compound propositions are often described by truth tables.
Example: The truth table for P  Q: P  Q
Q
P
T
T
T
F
F
T
T
T
F
T
F
F
P  Q  ‫ר‬P  Q
P  Q
‫ר‬P  Q
‫ר‬P
Q
P
T
T
T
F
T
T
T
F
F
F
F
T
T
T
T
T
T
F
T
T
T
T
F
F
10
 The truth tables for , , ‫ר‬, and  can be defined in
a similar fashion.
 The equivalence of two expressions may be
demonstrated using truth tables.
Example: A proof of the equivalence of P  Q and ‫ר‬P  Q:
Satisfiability and Validity
• A sentence is valid if it holds under every interpretation.
A valid sentence is called a tautology.
• A sentence is satisfiable if it holds under some interpretation.
• A sentence is unsatisfiable if it holds under no interpretation. An unsatisafiable
sentence is called a contradiction.
Examples:
1. The sentence P  (Q  P) is valid.
2. The sentence (Q  P)  P is satisfiable.
3. The sentence P  ‫ר‬P is unsatisfiable.
• These examples can be proved using truth tables.
11
The Predicate Calculus
In propositional calculus, each atomic symbol (P, Q, etc.) denotes a proposition of some
complexity. There is no way to access the components of an individual assertion.
Predicate calculus provides this ability.
A predicate is a parameterized proposition, that is a proposition with parameters/variables.
Predicate Logic deals with predicates, which are propositions containing variables.
For example, instead of letting a single propositional symbol, P, denote the entire sentence
"It rained on Tuesday", we can create a predicate weather that describes a relationship
between a date and the weather: weather (tuesday, rain).
Through inference rules we can manipulate predicate calculus expressions, accessing their
individual components and inferring new sentences.
Predicate calculus also allows expressions to contain variables.
 Variables let us create general assertions about classes of entities.
 For example we could state that for all values of X, where X is a day of the week, the statement
weather (X, rain) is true, i.e., it rains every day.
12
The syntax of the predicate calculus
Predicate calculus character set:
• The set of letters: a – z, and A – Z.
• They refer to objects without naming.
• Small letters refer to constant objects, while uppercase letters refers to variable
objects.
• The set of digits: 0, 1, …, 9.
• The underscore, _.
 Logical connectors: Logical connectives: , , ‫ר‬, , 
• Variable quantifiers: , 
• (Universal quantifier) for all 
• (Existential quantifier) there exist 
13
Predicate calculus symbols:
• Symbols in the predicate calculus begin with a letter and are followed by any sequence
of the legal characters mentioned above. No blanks allowed.
• Examples of legal predicate calculus symbols:
george fire3 tom_and_jerry bill XXX friends_of
• Examples of strings that are not legal predicate symbols:
3jak "no blanks allowed" ab%cd **71 duck!!
• Symbols are used to denote objects, properties, or relations in a world of discourse.
• Predicate calculus symbols may represent
1- Objects (either constants or Variables).
2- Relations (sometimes called predicates).
3- Functions.
• Objects and functions are known as terms.
14
The syntax of the predicate calculus
(1) Constants:
• They name specific objects or properties in the world.
• Constant symbols must begin with a lowercase letter.
• Examples of legal constant symbols:
george, tree, tall, and blue.
• The constants true and false are reserved as truth symbols.
(2) Variables:
• They are used to designate general classes of objects or properties in the world.
• Variables are represented by symbols beginning with an uppercase letter.
• Examples of legal variables: X, Man, Bird, and DAY.
15
The syntax of the predicate calculus
(3) Functions: They denote a mapping of one or more elements in the domain of the function
into a unique element of the range of the function.
• Elements of the domain and range are objects in the world of discourse.
• Function symbols begin with a lowercase letter.
• A function expression is a function symbol followed by its arguments enclosed in
parentheses and separated by commas.
• The number of arguments is called the arity of the function.
• Examples of well-formed function expressions:
Function expression f(X, Y) father(david) plus(2, 3)
Arity 2 1 2
• Each function expression denotes the mapping of the arguments onto a single object in the
range, called the value of the function.
• The act of replacing a function with its value is called evaluation.
16
The syntax of the predicate calculus
(4) Predicates:
• A predicate names a relationship between zero or more objects or between objects
and their properties in the world.
• Predicate symbols are symbols beginning with a lowercase letter.
• Examples of predicates are:
likes, equals, on, near, part_of, clear.
• Predicates have an associated positive integer referred to as the arity or the number
of its arguments.
17
The syntax of the predicate calculus
• Different between predicates (relations) and functions
• father (ahmed) , it is result may be Hussein (function)
• plus(one, two) , it is result is three (function)
• married(john, mary), it is result may be true (predicate – relation)
• Predicate give you true or false based on your input(s). While a function gives you an output per your
input(s).
18
The syntax of the predicate calculus
• An atomic sentence: is formed from a predicate symbol followed by list of terms t1, t2,
…, tn, enclosed in parentheses and separated by commas. So it is a predicate of arity n.
• A predicate calculus term is either a constant, variable, or function expression. It may be used to
denote objects and properties in the problem domain.
• Atomic Sentence = predicate (term1,.....,termn)
or term1 = term2
• Examples:
large_than(2,3) is false.
brother_of(Mary,Pete) is false.
married(father(Richard),mother(John)) could be true or false.
• Note: Functions do not state facts and form no sentence:
Brother(Pete) refers to John (his brother) and is neither true nor false
• The truth symbols, true and false, are also atomic sentences.
19
Predicate calculus sentences
• Other examples of atomic sentences are:
likes (george, kate) likes (X, george)
likes (george, sarah, tuesday) likes (X, Y)
friends (bill, george) helps (richard, bill)
friends (father_of(david), father_of(andrew))
20
Predicate calculus sentences
Predicate calculus sentences
• We make complex sentence with connectives (just like in propositional logic).
• Complex sentences: we can use logical connectors (, , ‫ר‬, , and ) to construct
more complex sentences, with the same syntax and semantics as in propositional
calculus.
• If 𝑆 is a sentence, then so is its negation, ‫ר‬ 𝑆 is a complex sentence.
• If 𝑆1 and 𝑆2 are sentences, then so are their:
conjunction, 𝑆1  𝑆2, disjunction, 𝑆1  𝑆2 are complex sentences,
implication, 𝑆1  𝑆2, and equivalence, 𝑆1  𝑆2 are complex sentences.
• Examples of complex sentences
• Brother(Richard, John) ∧ Brother(John, Richard)
• King(Richard) ∨ King (john)
• King(John)=> ᆨKing(Richard)
• LessThan(plus(1,2),4)∧GreaterThan(1,2)
21
Predicate calculus sentences
Examples:
Let plus be a function symbol of arity 2 and let equal and foo be predicate symbols
with arity 2 and 3, respectively:
• plus (two, three) is a function and thus not an atomic sentence.
• equal (plus (two, three), five) is an atomic sentence.
• equal (plus (two, three), seven) is an atomic sentence. Note that this sentence is
false.
•  X foo (X, two, plus (two, three))  equal (plus (two, three), five), is a complex
sentence.
22
Variable quantifiers
23
 Variable quantifiers are symbols that constrain the meaning of a sentence containing a
variable. Quantifiers determine when predicate calculus expressions are true.
 A quantifier Q is followed by a variable X and a sentence s: QXs.
 In the first order predicate calculus, there are two variable quantifiers:
 The universal quantifier, , indicates that the sentence is true for all values of the
variable. It allows us to make a statement about a collection of objects.
For example,
• All cats are mammals
 x:cat(x)  mammal(x)
• X likes (X, ice_cream) is true for all values in the domain of the definition of X.
 The existential quantifier, , indicates that the sentence is true for at least one value in
the domain.
For example, Y friends (Y, peter) is true if there is at least one person, indicated by Y,
that is a friend of peter.
Variable quantifiers examples
24
 Here some examples of variable quantifiers:
 George is a monkey and he is curious
 monkey (george)  curious (george)
 Monkeys are curious
 m: monkey(m)  curious(m)
 There is a curious monkey
  m: monkey(m)  curious(m)
 There exists an object that is either a curious monkey, or not a monkey at all
  m: (monkey(m)  curious(m))  ( ‫ר‬monkey(m)), or
  m: monkey(m)  curious(m)
Variable quantifiers examples
25
Properties of variable quantifiers
26
 For predicates p and q and variables X and Y:
1) x,y is the same as x y
2)  x,y is the same as  x  y
3) x y is the same as y x
4)  x  y is the same as  y  x
5)  x y is not the same as y  x
 Examples:
 “there is a person who loves everyone in the world”
  x y loves (x, y)
 “Everyone in the world is loved by at least one person”
 y  x loves (x, y)
6) Quantifier duality
• x p(x)  ‫ר‬ x ‫ר‬p(x)
•  x p(x)  ‫ר‬x ‫ר‬p(x)


Properties of variable quantifiers
27
7) Demogan’slaws
• ‫ר‬x p(x)   x ‫ר‬p(x)
• ‫ר‬ x p(x)  x ‫ר‬p(x)
Representing English sentences in predicate calculus
Examples:
• If it doesn't rain on Monday, Tom will go to the mountains.
‫ר‬ weather (rain, monday)  go (tom, mountains)
• A bluebird is a blue-colored bird.
is_a (bluebird, bird)  has_color (bluebird, blue)
• All basketball players are tall.
X (basketball_player (X)  tall (X))
• Some people like anchovies.
X (person (X)  likes (X, anchovies))
• If wishes were horses, beggars would ride.
equal (wishes, horses)  ride (beggars)
• No body likes taxes.
‫ר‬X likes (X, taxes)
or X ‫ר‬likes (X, taxes)
• No body is right if everybody is wrong.
X (‫ר‬ right (X)  wrong (X))
28
Representing English sentences in predicate calculus
29
30
Example:
 This is an example of the use of predicate calculus to describe a simple world. The
domain of discourse is a set of known family relationships:
mother (eve, abel)
mother (eve, cain)
father (adam, able)
father (adam, cain)
X Y (father (X, Y)  mother (X, Y)  parent (X, Y))
X Y Z (parent (X, Y)  parent (X, Z)  sibling (Y, Z))
 These implications can be used to infer facts such as
sibling (abel, cain).
 The predicates mother and father are used to define a set of parent-child relationships.
The implications give general definitions of other relationships, such as parent and
sibling, in terms of these predicates.
31
Several relationships between negation and the universal and the existential quantifiers are
given below. Also, the notion of a variable name as a dummy symbol that stands for a set
of constants is noted.
For predicates p and q and variables X and Y:
‫ר‬X p(X)  X ‫ר‬p(X)
‫ר‬X p(X)  X ‫ר‬p(X)
X p(X)  Y p(Y)
X q(X)  Y q(Y)
X (p(X)  q(X))  X p(X)  Y q(Y)
X (p(X)  q(X))  X p(X)  Y q(Y)
THANK YOU
For any questions feel free
to contact me by mail
Gh_mcs86@yahoo.com

More Related Content

Similar to lec3 AI.pptx

Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Ashish Duggal
 
Propositional logic is a good vehicle to introduce basic properties of logic
Propositional logic is a good vehicle to introduce basic properties of logicPropositional logic is a good vehicle to introduce basic properties of logic
Propositional logic is a good vehicle to introduce basic properties of logicpendragon6626
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)SHUBHAM KUMAR GUPTA
 
Unit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfUnit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfHrideshSapkota2
 
Knowledege Representation.pptx
Knowledege Representation.pptxKnowledege Representation.pptx
Knowledege Representation.pptxArslanAliArslanAli
 
I am kind of confused about quantifiers. I am not sure how to transl.pdf
I am kind of confused about quantifiers. I am not sure how to transl.pdfI am kind of confused about quantifiers. I am not sure how to transl.pdf
I am kind of confused about quantifiers. I am not sure how to transl.pdfAMITPANCHAL154
 
Propositional logic(part 2)
Propositional logic(part 2)Propositional logic(part 2)
Propositional logic(part 2)SURBHI SAROHA
 
AI NOTES ppt 4.pdf
AI NOTES ppt 4.pdfAI NOTES ppt 4.pdf
AI NOTES ppt 4.pdfARMANVERMA7
 
20220818151924_PPT01 - The Logic of Compound and Quantitative Statement.pptx
20220818151924_PPT01 - The Logic of Compound and Quantitative Statement.pptx20220818151924_PPT01 - The Logic of Compound and Quantitative Statement.pptx
20220818151924_PPT01 - The Logic of Compound and Quantitative Statement.pptxssuser92109d
 
A course on mathematical logic
A course on mathematical logicA course on mathematical logic
A course on mathematical logicSpringer
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)Nitesh Singh
 
Foundations of Knowledge Representation in Artificial Intelligence.pptx
Foundations of Knowledge Representation in Artificial Intelligence.pptxFoundations of Knowledge Representation in Artificial Intelligence.pptx
Foundations of Knowledge Representation in Artificial Intelligence.pptxkitsenthilkumarcse
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAsst.prof M.Gokilavani
 

Similar to lec3 AI.pptx (20)

Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
 
Propositional logic is a good vehicle to introduce basic properties of logic
Propositional logic is a good vehicle to introduce basic properties of logicPropositional logic is a good vehicle to introduce basic properties of logic
Propositional logic is a good vehicle to introduce basic properties of logic
 
Module_4_2.pptx
Module_4_2.pptxModule_4_2.pptx
Module_4_2.pptx
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 
Unit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfUnit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdf
 
AI-09 Logic in AI
AI-09 Logic in AIAI-09 Logic in AI
AI-09 Logic in AI
 
Knowledege Representation.pptx
Knowledege Representation.pptxKnowledege Representation.pptx
Knowledege Representation.pptx
 
I am kind of confused about quantifiers. I am not sure how to transl.pdf
I am kind of confused about quantifiers. I am not sure how to transl.pdfI am kind of confused about quantifiers. I am not sure how to transl.pdf
I am kind of confused about quantifiers. I am not sure how to transl.pdf
 
Propositional logic(part 2)
Propositional logic(part 2)Propositional logic(part 2)
Propositional logic(part 2)
 
continuity of module 2.pptx
continuity of module 2.pptxcontinuity of module 2.pptx
continuity of module 2.pptx
 
AI NOTES ppt 4.pdf
AI NOTES ppt 4.pdfAI NOTES ppt 4.pdf
AI NOTES ppt 4.pdf
 
10a.ppt
10a.ppt10a.ppt
10a.ppt
 
01bkb04p.ppt
01bkb04p.ppt01bkb04p.ppt
01bkb04p.ppt
 
20220818151924_PPT01 - The Logic of Compound and Quantitative Statement.pptx
20220818151924_PPT01 - The Logic of Compound and Quantitative Statement.pptx20220818151924_PPT01 - The Logic of Compound and Quantitative Statement.pptx
20220818151924_PPT01 - The Logic of Compound and Quantitative Statement.pptx
 
A course on mathematical logic
A course on mathematical logicA course on mathematical logic
A course on mathematical logic
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)
 
Logic.ppt
Logic.pptLogic.ppt
Logic.ppt
 
English for Math Pertemuan ke 11
English for Math Pertemuan ke 11English for Math Pertemuan ke 11
English for Math Pertemuan ke 11
 
Foundations of Knowledge Representation in Artificial Intelligence.pptx
Foundations of Knowledge Representation in Artificial Intelligence.pptxFoundations of Knowledge Representation in Artificial Intelligence.pptx
Foundations of Knowledge Representation in Artificial Intelligence.pptx
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
 

Recently uploaded

Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDRafezzaman
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceSapana Sha
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAbdelrhman abooda
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一fhwihughh
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 

Recently uploaded (20)

Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts Service
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 

lec3 AI.pptx

  • 1. Obour Institute Lec_4, 5 Logic-based Knowledge Representation
  • 2. Logic-based Knowledge Representation • Different types of logic that can be used to represent knowledge are: • Propositional calculus (or logic) PL. • predicate calculus (or logic) some times called First order logic (FOL). • Logic or belief. • Logic can be defined as the study of correct inference, i.e. what follows from what. 2
  • 3. Logic-based Knowledge Representation • Logic usually consists of syntax, semantics and a proof theory. • The syntax of logic defines a formal language of the logic. • The semantics of logic specifies the meanings of the well-formed expressions of the logical language. • Semantics is the study of meaning • The proof theory of logic provides a purely formal specification of the notion of correct inference. • This chapter introduces the propositional calculus and the predicate calculus as logic- based knowledge representation languages for AI. 3
  • 4. The Propositional Calculus 1) The syntax of the propositional calculus: The first step in describing a language is to introduce its set of symbols.  Propositional calculus symbols are:  the propositional symbols: P, Q, R, S, … (uppercase letters near the end of the English alphabet)  truth symbols or logical constants: true, false  Logical connectives: , , ‫ר‬, ,   Propositional symbols denote propositions, or statements about the world that may be either true or false, such as "the car is red". 4
  • 5. Rules of forming legal propositional calculus sentences: 1. Every single propositional symbol and truth symbol is called atomic sentence. e.g. true, P, Q, and R are sentences. 2. The negation of atomic sentence is a complex sentence. e.g. ‫ר‬P and ‫ר‬false are complex sentences. 3. The conjunction, i.e. and, of two atomic sentence is a complex sentence. e.g. P  Q is a complex sentence. 4. The disjunction, i.e. or, of two atomic sentence is a complex sentence. e.g. P  Q is a complex sentence. 5. The implication of one sentence from another is a complex sentence. e.g. P  Q is a complex sentence. 6. The equivalence of two atomic or complex sentence is a complex sentence. e.g. P  Q  R is a complex sentence. • Legal sentences are also called well-formed formulas or WFFs. 5
  • 6. 6  In P  Q, is pronounced P and Q, P and Q are called conjuncts.  In P  Q, is pronounced P or Q, P and Q are called disjuncts.  In P  Q, P is the premise and Q is the conclusion. • It means P implies Q. If the implication is true when the premise is true, the conclusion must also be true. • Ex: if it rainy, the earth would be wet @Sinaiunieg www.su.edu.eg info@su.edu.eg Rules of forming legal propositional calculus sentences:
  • 7.  The semantics of propositional calculus is defined as follows:  Semantics of PL is the interpretation of the propositional symbols (P, Q, R,…) and logical constants (true, false) and specifying the meaning of the logical connectors (‫ר‬, , , , ).  An interpretation of a set of propositions is the assignment of a truth value, either T or F, to each propositional symbol.  Formally, an interpretation is a mapping from the propositional symbols into the set {T, F}.  A propositional symbol corresponds to a statement about the world.  EX:- P may denote the statement “it is raining” or “Paris is the capital of France”.  Note that, the symbols true and false (logical constants) are part of the set of well- formed sentences of the propositional calculus; i.e. they are distinct from the truth value, T/F, assigned to a sentence. 7 Rules of forming legal propositional calculus sentences: 2) The semantics of the propositional calculus:
  • 8.  Where we have only two truth values (i.e. T or F) as an interpretation for each propositional symbol, then if we have n propositional symbols, we can define 𝟐𝒏 different interpretations.  For example, if P denotes the proposition "it is raining" and Q denotes "I am at work", then the set of propositions {P, Q} has different functional mapping into the truth values {T, F}. These mappings correspond to 4 different interpretations. 8 Rules of forming legal propositional calculus sentences:
  • 9. The interpretation or truth value assignment for sentences is determined as follows: Condition Truth value assignment Sentence T true F false If P has truth value F. If P has truth value T. T F ‫ר‬P If both P and Q has truth value T. Otherwise. T F P  Q If both P and Q has truth value F. Otherwise. F T P  Q If P is T and Q is F. Otherwise. F T P  Q If P and Q have the same truth value assignments for all possible interpretations. Otherwise. T F P  Q 9
  • 10. • The truth assignments of compound propositions are often described by truth tables. Example: The truth table for P  Q: P  Q Q P T T T F F T T T F T F F P  Q  ‫ר‬P  Q P  Q ‫ר‬P  Q ‫ר‬P Q P T T T F T T T F F F F T T T T T T F T T T T F F 10  The truth tables for , , ‫ר‬, and  can be defined in a similar fashion.  The equivalence of two expressions may be demonstrated using truth tables. Example: A proof of the equivalence of P  Q and ‫ר‬P  Q:
  • 11. Satisfiability and Validity • A sentence is valid if it holds under every interpretation. A valid sentence is called a tautology. • A sentence is satisfiable if it holds under some interpretation. • A sentence is unsatisfiable if it holds under no interpretation. An unsatisafiable sentence is called a contradiction. Examples: 1. The sentence P  (Q  P) is valid. 2. The sentence (Q  P)  P is satisfiable. 3. The sentence P  ‫ר‬P is unsatisfiable. • These examples can be proved using truth tables. 11
  • 12. The Predicate Calculus In propositional calculus, each atomic symbol (P, Q, etc.) denotes a proposition of some complexity. There is no way to access the components of an individual assertion. Predicate calculus provides this ability. A predicate is a parameterized proposition, that is a proposition with parameters/variables. Predicate Logic deals with predicates, which are propositions containing variables. For example, instead of letting a single propositional symbol, P, denote the entire sentence "It rained on Tuesday", we can create a predicate weather that describes a relationship between a date and the weather: weather (tuesday, rain). Through inference rules we can manipulate predicate calculus expressions, accessing their individual components and inferring new sentences. Predicate calculus also allows expressions to contain variables.  Variables let us create general assertions about classes of entities.  For example we could state that for all values of X, where X is a day of the week, the statement weather (X, rain) is true, i.e., it rains every day. 12
  • 13. The syntax of the predicate calculus Predicate calculus character set: • The set of letters: a – z, and A – Z. • They refer to objects without naming. • Small letters refer to constant objects, while uppercase letters refers to variable objects. • The set of digits: 0, 1, …, 9. • The underscore, _.  Logical connectors: Logical connectives: , , ‫ר‬, ,  • Variable quantifiers: ,  • (Universal quantifier) for all  • (Existential quantifier) there exist  13
  • 14. Predicate calculus symbols: • Symbols in the predicate calculus begin with a letter and are followed by any sequence of the legal characters mentioned above. No blanks allowed. • Examples of legal predicate calculus symbols: george fire3 tom_and_jerry bill XXX friends_of • Examples of strings that are not legal predicate symbols: 3jak "no blanks allowed" ab%cd **71 duck!! • Symbols are used to denote objects, properties, or relations in a world of discourse. • Predicate calculus symbols may represent 1- Objects (either constants or Variables). 2- Relations (sometimes called predicates). 3- Functions. • Objects and functions are known as terms. 14 The syntax of the predicate calculus
  • 15. (1) Constants: • They name specific objects or properties in the world. • Constant symbols must begin with a lowercase letter. • Examples of legal constant symbols: george, tree, tall, and blue. • The constants true and false are reserved as truth symbols. (2) Variables: • They are used to designate general classes of objects or properties in the world. • Variables are represented by symbols beginning with an uppercase letter. • Examples of legal variables: X, Man, Bird, and DAY. 15 The syntax of the predicate calculus
  • 16. (3) Functions: They denote a mapping of one or more elements in the domain of the function into a unique element of the range of the function. • Elements of the domain and range are objects in the world of discourse. • Function symbols begin with a lowercase letter. • A function expression is a function symbol followed by its arguments enclosed in parentheses and separated by commas. • The number of arguments is called the arity of the function. • Examples of well-formed function expressions: Function expression f(X, Y) father(david) plus(2, 3) Arity 2 1 2 • Each function expression denotes the mapping of the arguments onto a single object in the range, called the value of the function. • The act of replacing a function with its value is called evaluation. 16 The syntax of the predicate calculus
  • 17. (4) Predicates: • A predicate names a relationship between zero or more objects or between objects and their properties in the world. • Predicate symbols are symbols beginning with a lowercase letter. • Examples of predicates are: likes, equals, on, near, part_of, clear. • Predicates have an associated positive integer referred to as the arity or the number of its arguments. 17 The syntax of the predicate calculus
  • 18. • Different between predicates (relations) and functions • father (ahmed) , it is result may be Hussein (function) • plus(one, two) , it is result is three (function) • married(john, mary), it is result may be true (predicate – relation) • Predicate give you true or false based on your input(s). While a function gives you an output per your input(s). 18 The syntax of the predicate calculus
  • 19. • An atomic sentence: is formed from a predicate symbol followed by list of terms t1, t2, …, tn, enclosed in parentheses and separated by commas. So it is a predicate of arity n. • A predicate calculus term is either a constant, variable, or function expression. It may be used to denote objects and properties in the problem domain. • Atomic Sentence = predicate (term1,.....,termn) or term1 = term2 • Examples: large_than(2,3) is false. brother_of(Mary,Pete) is false. married(father(Richard),mother(John)) could be true or false. • Note: Functions do not state facts and form no sentence: Brother(Pete) refers to John (his brother) and is neither true nor false • The truth symbols, true and false, are also atomic sentences. 19 Predicate calculus sentences
  • 20. • Other examples of atomic sentences are: likes (george, kate) likes (X, george) likes (george, sarah, tuesday) likes (X, Y) friends (bill, george) helps (richard, bill) friends (father_of(david), father_of(andrew)) 20 Predicate calculus sentences
  • 21. Predicate calculus sentences • We make complex sentence with connectives (just like in propositional logic). • Complex sentences: we can use logical connectors (, , ‫ר‬, , and ) to construct more complex sentences, with the same syntax and semantics as in propositional calculus. • If 𝑆 is a sentence, then so is its negation, ‫ר‬ 𝑆 is a complex sentence. • If 𝑆1 and 𝑆2 are sentences, then so are their: conjunction, 𝑆1  𝑆2, disjunction, 𝑆1  𝑆2 are complex sentences, implication, 𝑆1  𝑆2, and equivalence, 𝑆1  𝑆2 are complex sentences. • Examples of complex sentences • Brother(Richard, John) ∧ Brother(John, Richard) • King(Richard) ∨ King (john) • King(John)=> ᆨKing(Richard) • LessThan(plus(1,2),4)∧GreaterThan(1,2) 21
  • 22. Predicate calculus sentences Examples: Let plus be a function symbol of arity 2 and let equal and foo be predicate symbols with arity 2 and 3, respectively: • plus (two, three) is a function and thus not an atomic sentence. • equal (plus (two, three), five) is an atomic sentence. • equal (plus (two, three), seven) is an atomic sentence. Note that this sentence is false. •  X foo (X, two, plus (two, three))  equal (plus (two, three), five), is a complex sentence. 22
  • 23. Variable quantifiers 23  Variable quantifiers are symbols that constrain the meaning of a sentence containing a variable. Quantifiers determine when predicate calculus expressions are true.  A quantifier Q is followed by a variable X and a sentence s: QXs.  In the first order predicate calculus, there are two variable quantifiers:  The universal quantifier, , indicates that the sentence is true for all values of the variable. It allows us to make a statement about a collection of objects. For example, • All cats are mammals  x:cat(x)  mammal(x) • X likes (X, ice_cream) is true for all values in the domain of the definition of X.  The existential quantifier, , indicates that the sentence is true for at least one value in the domain. For example, Y friends (Y, peter) is true if there is at least one person, indicated by Y, that is a friend of peter.
  • 24. Variable quantifiers examples 24  Here some examples of variable quantifiers:  George is a monkey and he is curious  monkey (george)  curious (george)  Monkeys are curious  m: monkey(m)  curious(m)  There is a curious monkey   m: monkey(m)  curious(m)  There exists an object that is either a curious monkey, or not a monkey at all   m: (monkey(m)  curious(m))  ( ‫ר‬monkey(m)), or   m: monkey(m)  curious(m)
  • 26. Properties of variable quantifiers 26  For predicates p and q and variables X and Y: 1) x,y is the same as x y 2)  x,y is the same as  x  y 3) x y is the same as y x 4)  x  y is the same as  y  x 5)  x y is not the same as y  x  Examples:  “there is a person who loves everyone in the world”   x y loves (x, y)  “Everyone in the world is loved by at least one person”  y  x loves (x, y) 6) Quantifier duality • x p(x)  ‫ר‬ x ‫ר‬p(x) •  x p(x)  ‫ר‬x ‫ר‬p(x)  
  • 27. Properties of variable quantifiers 27 7) Demogan’slaws • ‫ר‬x p(x)   x ‫ר‬p(x) • ‫ר‬ x p(x)  x ‫ר‬p(x)
  • 28. Representing English sentences in predicate calculus Examples: • If it doesn't rain on Monday, Tom will go to the mountains. ‫ר‬ weather (rain, monday)  go (tom, mountains) • A bluebird is a blue-colored bird. is_a (bluebird, bird)  has_color (bluebird, blue) • All basketball players are tall. X (basketball_player (X)  tall (X)) • Some people like anchovies. X (person (X)  likes (X, anchovies)) • If wishes were horses, beggars would ride. equal (wishes, horses)  ride (beggars) • No body likes taxes. ‫ר‬X likes (X, taxes) or X ‫ר‬likes (X, taxes) • No body is right if everybody is wrong. X (‫ר‬ right (X)  wrong (X)) 28
  • 29. Representing English sentences in predicate calculus 29
  • 30. 30 Example:  This is an example of the use of predicate calculus to describe a simple world. The domain of discourse is a set of known family relationships: mother (eve, abel) mother (eve, cain) father (adam, able) father (adam, cain) X Y (father (X, Y)  mother (X, Y)  parent (X, Y)) X Y Z (parent (X, Y)  parent (X, Z)  sibling (Y, Z))  These implications can be used to infer facts such as sibling (abel, cain).  The predicates mother and father are used to define a set of parent-child relationships. The implications give general definitions of other relationships, such as parent and sibling, in terms of these predicates.
  • 31. 31 Several relationships between negation and the universal and the existential quantifiers are given below. Also, the notion of a variable name as a dummy symbol that stands for a set of constants is noted. For predicates p and q and variables X and Y: ‫ר‬X p(X)  X ‫ר‬p(X) ‫ר‬X p(X)  X ‫ר‬p(X) X p(X)  Y p(Y) X q(X)  Y q(Y) X (p(X)  q(X))  X p(X)  Y q(Y) X (p(X)  q(X))  X p(X)  Y q(Y)
  • 32. THANK YOU For any questions feel free to contact me by mail Gh_mcs86@yahoo.com