SlideShare a Scribd company logo
1 of 53
Chapter 2:
First Order Logic (FOL)
What is Logic ?
• KBS needs to express general rules and represent specific cases.
• The logic is appropriate for knowledge representation and reasoning.
• ‫واالستدالل‬ ‫المعرفة‬ ‫لتمثيل‬ ‫مناسب‬ ‫المنطق‬
.
• The logic is the study of entailment relations, languages, truth
conditions, and rules of inference.
• ‫االستدالل‬ ‫وقواعد‬ ‫الحقيقة‬ ‫وشروط‬ ‫واللغات‬ ‫االستداللية‬ ‫العالقات‬ ‫دراسة‬ ‫هو‬ ‫المنطق‬
.
First-Order Logic (FOL)
• Objects represent a set of relevant facts in a specific domain.
• First-Order Logic (FOL) is a knowledge representation language used
in mathematics, philosophy, linguistics, computer science, and
artificial intelligence for reasoning and knowledge representation in
order to express logical concepts.
• First-order logic is also known as Predicate logic or First-order
predicate logic.
• Basically, FOL is used for representing information about the objects
(entities) and the relationships between these objects.
• We also use it for representing the rules induced from this set of
objects and the relationships between them.
• FOL deals with declarative propositions and uses quantifiers and
relations for expressing knowledge.
• FOL uses quantified variables over non-logical objects, and allows the
use of sentences that contain variables, so that rather than
propositions such as "Socrates is a man“, one can have expressions in
the form "there exists x such that x is Socrates and x is a man", where
"there exists" is a quantifier ‫المحدد‬ , while x is a variable ‫متغير‬ .
Objects, relations, and functions
• Objects: A, B, people, numbers, colors, houses, theories,
games, ......
• Relations: It can be unary relation ‫احادية‬ ‫عالقة‬ such as: red,
round, prime, or any relation such as: the sister of, brother
of, has color, comes between, part of, owns
• Function: Father of, best friend, Mother of, end of, beginning
of ......
FOL
• The first-order logic language has two main parts:
1. Syntax ‫شكل‬

‫صيغة‬

‫الرموز‬ ‫بنية‬
2. Semantics ‫الجملة‬ ‫سياق‬ ‫من‬ ‫المفهوم‬ ‫الرموز‬ ‫معنى‬
1. Syntax of FOL
• The syntax of FOL is a set of logical symbols, arranged in a
properly formed way.
• ‫وصحيح‬ ‫جيد‬ ‫بشكل‬ ‫المرتبة‬ ‫المنطقية‬ ‫الرموز‬ ‫من‬ ‫مجموعة‬ ‫هو‬
• The syntax of FOL determines which collection of symbols is a
well-formed and a logical expression in first-order logic.
• ‫جيد‬ ‫بشكل‬ ‫مضاع‬ ‫منطقي‬ ‫تعبير‬ ‫تمثل‬ ‫الرموز‬ ‫من‬ ‫مجموعه‬ ‫اي‬ ‫يحدد‬
• So, we write statements in short-hand notation ‫رموز‬ in FOL
using a set of logical symbols.
• We know that the sentences of the language are what express
propositions. ‫والفرضيات‬ ‫االقتراحات‬ ‫عن‬ ‫تعبر‬ ‫التي‬ ‫هي‬ ‫اللغة‬ ‫جمل‬
Example of sentence syntax in general
• In English language, for example:
the noun phrase “the food that my mother loves” is a well-formed
noun phrase.
‫صحيح‬ ‫بشكل‬ ‫ومصاغة‬ ‫مشكلة‬ ‫اسمية‬ ‫جملة‬ ‫شبة‬ ‫هي‬
• but the noun phrase “that the my loves mother food” is a not well-
formed noun phrase.
‫اسمية‬ ‫جملة‬ ‫شبة‬ ‫هي‬
‫غير‬
‫صحيح‬ ‫بشكل‬ ‫ومصاغة‬ ‫مشكلة‬
2. Semantic of FOL
• Semantic of FOL represents what is the well-formed expressions are
supposed to mean.
‫صحيحة‬ ‫بصيغة‬ ‫المشكلة‬ ‫للجمل‬ ‫المعنى‬
• Some well-formed expressions like “the hardnosed decimal holiday” might
not mean anything.
• For sentences, we need to be clear about what idea that is being
expressed. We must express the sentence in a meaningful way.
• In English, for example, “There is someone right behind you” could be used
as a warning to be careful in some contexts ‫الجمله‬ ‫سياق‬ and a request to
move in others.
• ‫الجملة‬ ‫سياق‬ ‫من‬ ‫يفهم‬ ‫المعنى‬
Basic Elements of First-order logic syntax:
1. Constants
2. Variables
3. Predicates
4. Functions
5. Logical Connectives
6. Equality
7. Quantifiers
8. Punctuations
9. Well-Formed Formulas
Constants 1, 2, A, John, Mumbai, cat,....
Variables x, y, z, a, b,....
Predicates Brother, Father, Mother, >,....
Functions sqrt, LeftLegOf, ....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifiers ∀ ‫لكل‬, ∃ ‫يوجد‬
Basic Elements of First-order logic syntax:
The following are the basic elements of FOL syntax:
Punctuations “(”, “)”, and “.”.
Logical symbols
• Please see the pdf file for the rest of the logical symbols and their
meanings.
Logical symbols
• The logical symbol ∀ is a universal quantifier that denotes “for all” ‫لكل‬
• The logical symbol ∈, for example x ∈ A indicates that an element x is a
member in a set A ‫لمجموعه‬ ‫ينتمي‬ ‫العنصر‬
• xA means that the element x is not a member in the set A
• The logical symbol ∪ denotes a union ‫تكرار‬ ‫بدون‬ ‫المجموعتين‬ ‫عناصر‬ ‫لجميع‬ ‫اتحاد‬
• The logical symbol ⊨ means an implication (entailment). ‫او‬ ‫يشمل‬ ‫او‬ ‫يتضمن‬
‫على‬ ‫ينطوي‬ ‫او‬ ‫يعني‬
• The logical symbol ⊭ indicates a negated implication. ‫اليتضمن‬
• C ⊆G, C is a subset of G, where ⊆ indicates a subset. ‫جزئية‬ ‫مجموعه‬
Logical symbols
• The logical symbol ∃ means there exists
• The logical symbol ∄ means there does not exists
• The logical symbol ¬ means NOT
• The logical symbol ^ means AND (conjunction)
• The logical symbol  means OR (disjunction)
• The logical symbol  means if … then ; implies
• The logical symbol  means if … then ; implies
Logical symbols
• The logical symbol  means if and only if (equivalent)
• The logical symbol  means if and only if (equivalent)
• The logical symbol = is logical equality
• The logical symbol  means is defined as (x  y means x is defined to
be another name for y)
• The logical symbol ⊨ means entails ‫تتضمن‬ (x ⊨ y means x semantically
entails y, A  B ⊨ ¬ B  ¬ A)
• The logical symbols !, ¬, ~, x‘ means not – negation ‫نفي‬
Logical symbols
• A  B means that A is a subset of B (every element in
the A set is contained in the B set).
• A  B means that A is NOT a subset of B (NOT every
element in the A set is contained in the B set).
• ∀ and ∃ are called quantifiers.
• Variables: an infinite supply of symbols, which we will denote here
using x, y, and z.
• The non-logical symbols are those that have an application-
dependent meaning or use ‫التطبيق‬ ‫على‬ ‫يعتمد‬ ‫اواستخدام‬ ‫معنى‬ ‫لها‬ ‫التي‬ ‫الرموز‬ ‫هي‬.
• In FOL, there are two sorts of non-logical symbols:
1. Function symbols
2. Predicate symbols
The non-logical symbols
1. Function symbols: an infinite supply of symbols, which we will
write in uncapitalized mixed case, e.g., bestFriend, and which we will
denote more generally using a, b, c, f , g, and h, with subscripts and
superscripts. ‫والمرتفعه‬ ‫المنخفضة‬ ‫الحروف‬ ‫مع‬
2. Predicate symbols: an infinite supply of symbols, which we will write
in capitalized mixed case, e.g., OlderThan, and which we will denote
more generally using P, Q, and R, with subscripts and superscripts.
Two types of sentences
1. Atomic sentences
2. Complex Sentences
1. Atomic sentences
• An atomic sentence is a clause ‫الجملة‬.
• A clause is a disjunction of literals ‫منفصله‬ ‫وكلمات‬ ‫حروف‬
• Atomic sentences are the basic sentences of first-order logic. These sentences
are formed from a predicate symbol followed by a parenthesis ‫اقواس‬ with a
sequence of terms.
• We can represent atomic sentences as Predicate (term1, term2, ...., term n).
• A term is a variable ‫متغير‬ or constant ‫ثابث‬ or function (Any expression f(t1,...,tn)) .
Examples of Atomic sentences
1. Ravi and Ajay are brothers
Brother(ravi, ajay).
2. Chinky is a cat
cat (chinky).
3. Sally and Sara are sisters
Sister(sally, sara)
SALLY is a sister of Sara
Predicates
What is a predicate?
• A predicate: is a relation between objects. For example:
color(snow, white)
The above example consists of the predicate “color” and the two
(terms/arguments) “snow” and “white”.
• A predicate takes an entity or entities in the domain of discourse ( ‫مجال‬
‫)الحوار‬ as input while outputs are either True or False.
• A domain of discourse specifies the range of the quantifiers.
• Relationships between predicates can be stated using logical
connectives (∧, ∨, ¬, ⇒, ⇔).
• Quantifiers (∀, ∃) can be applied to variables in a formula.
More examples of predicates:
• color(snow, white)
• color(sky, blue)
• color(banana, yellow)
• color(grass, green)
2. Complex Sentences:
• Complex sentences are made by combining ‫ربط‬ atomic
sentences using connectives (∧, ∨, ¬, ⇒, ⇔).
First-order logic statements can be divided into two parts:
• Subject: Subject is the main part of the statement.
• Predicate: A predicate can be defined as a relation, which
joins two atoms together in a statement.
• Consider the statement:
"x is an integer“.
The above statement consists of two parts: In the first part x
is the subject of the statement, and in the second part "is an
integer," is the predicate.
The above statement is represented in FOL as:
Integer(x)
‫سبق‬ ‫لما‬ ‫مراجعة‬
‫اكثر‬ ‫بشكل‬ ‫للتوضيح‬
Quantifiers in First-order logic (FOL):
• A quantifier ‫المحدد‬ is a language element which generates quantifications ‫تحديد‬
‫الكميات‬
• Quantification specifies the quantity of specimenexamples ‫او‬ ‫مثال‬ ‫او‬ ‫عينة‬
‫نموذج‬ in the universe of discourse‫الحوار‬ ‫عالم‬ ‫او‬ ‫مجال‬
• The universe (domain) of discourse is the complete range ‫الكامل‬ ‫النطاق‬ of
objects, facts, events, attributes, relations, ideas, that are expressed,
assumed, or implied in a discussion‫معين‬ ‫حوار‬ ‫او‬ ‫معين‬ ‫نقاش‬ ‫في‬ .
• These are the symbols that permit to determine the range and scope of the
variable in the logical expression.
There are two types of quantifier:
1. Universal Quantifier, (for all, everyone, everything)
2. Existential quantifier, (for some, there is at least one, there exists).
1. 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 ∀ ‫لكل‬
• Note: In universal quantifier we use implication "→".
• If X is a variable, then ∀X is read as:
• For all X
• For each X
• For every X
1. Universal Quantifier
• An example of universal quantifier:
1. All men drink coffee
∀ x man(X) → drink(X, coffee)
Suppose that x is a variable which
refers to a man.
x1, x2, x3, x4 ∈ X
∀x man(X) → drink (X, coffee).
2. Existential Quantifier ∃ :
• Existential quantifier is a 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 ∃
• 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 the Existential quantifier will be ∃x or ∃(x). And it will
be read as:
• There exists a ‘X'
• For some ‘X'
• For at least one ‘X'
2. Existential Quantifier:
• An example of Existential quantifier:
• some boys are intelligent.
∃X boy(X) ∧ intelligent(X)
Suppose that x is a variable which
represent a boy.
x1, x2, x3, x4 ∈ X
• ∃X: boys(X) ∧ intelligent(X)
Points to remember:
• The main connective for universal quantifier ∀ is implication →.
• The main connective for existential quantifier ∃ is and ∧.
Properties of Quantifiers:
• In universal quantifier, ∀x∀y is similar to ∀y∀x.
• In Existential quantifier, ∃x∃y is similar to ∃y∃x.
• ∃x∀y is not similar to ∀y∃x.
Some examples of mapping sentences into
FOL using quantifiers:
• 1. All birds fly.
∀X bird(X) → fly (X)
In this question, the predicate is "fly(bird).“
Using FOL quantifier, the above sentence is represented
as follows:
∀X bird(X) → fly(X).
Some examples of mapping sentences into
FOL using quantifiers:
• All men are mortal (‫)بشر‬
∀X man(X) → mortal(X)
The above sentence is represented using FOL as follows:
∀X man(X) → mortal (X).
• Every man respects his parent.
∀X man(X) → respect (X, 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. All boys play cricket.
∀X boy(X) → play(X , cricket)
In this question, the predicate is "play(X, Y)," where x=
boys, and y= cricket game.
• The above sentence will be represented as:
∀X boys(X) → play(X, cricket).
• 4. Some boys play cricket.
• ∃X boy (X) ∧ play (X, cricket)
In this question, the predicate is "play(X, Y)," where X=
boys, and Y= cricket game.
• Since there are some boys so we will use ∃, and it will
be represented as:
∃X boys(X) ∧ play(X, cricket).
• 5. Not all students like both Mathematics and Science.
In this question, the predicate is "like(X, Y)," where X=
student, and Y= subject which is Mathematics and
Science.
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)].
• All IT students are smart.
The above sentence is represented as follows:
∀X IT_student(X) → smart (X)
• Ahmad owns a car.
owns(ahmad, car)
The above sentence is represented as follows:
owns (ahmad, car)
or in general: ∀XY Owns (X, Y)
Constants
Variables
• Every dog is an animal.
The above sentence is represented as follows:
∀X dog(X) → animal (X)
• All cats are cute.
The above sentence is represented as follows:
∀X cat(X) → cute (X)
• Every fruit is rich in vitamins.
The above sentence is represented as follows:
∀X fruit(X) → is_rich (X, vitamins).
• Every orange is a fruit.
The above sentence is represented as follows:
∀X orange(X) → fruit(X)
Then,
every orange is rich in vitamins.
∀X orange(X) → is_rich (X, vitamins).
• All frogs are green.
X frog(X)  green (X)
• Some frogs are green.
X frog(X) ∧ green(X)
Not all frogs are green.
¬ ∀ X frog(X)  green(X)
• Some frogs are not green.
X ( frog(X) ∧ ¬ green(X))
• Everybody loves somebody.
• Suppose that Everybody refers to X
• Suppose that somebody refers to Y
The above sentence is represented as follows:
∀X ∃Y loves(X, Y).
• Cat of Sami is cute.
isCute(catOf(sami))
The above sentence is represented as follows:
isCute (catOf(Sami))
• Some dogs are pets. (‫اليفة‬ ‫)حيوانات‬
X dog(X) ∧ pets(X)
The above sentence is represented as follows:
∃X dog(X) ∧ pet (X)
• Brothers are siblings (‫اشقاء‬ ‫هم‬ ‫)االخوة‬.
• X  Y brother (X, Y)  sibling( X, Y)
• Mother is one female parent.
• X Y mother(X, Y)  female(X) ∧ parent (X, Y)
• Father is one male parent.
• X  Y father(X, Y)  male (X) ∧ parent (X, Y)
• A cousin is a child of a parent’s sibling.
‫الوالدين‬ ‫احد‬ ‫شقيق‬ ‫ابن‬ ‫هو‬ ‫العم‬ ‫ابن‬
The above sentence is represented as follows:
∀X ∀Y cousin (X, Y) → ∃ Z, F parent (Z, X) ∧ sibling (Z, F) ∧ parent (F, Y)
• For every computer virus, there is an anti-virus program that kills it.
• Suppose computer virus refers to X
• Suppose antivirus refers to Y
 X  Y kills( Y, X)
• All students studying AI are genius.
X student (X) ∧ studyingAI(X) → genius(X)
The above sentence is represented as follows:
• Some students studying AI are genius and homeworking.
 X student(X) ∧ studyingAI(X) ∧ genius(X) ∧ homeworking(X)
The above sentence is represented as follows:
∃x student(X) ∧ studyingAI (X) ∧ genius(X) ∧ homeworking(X)
• No one likes Sami.
The above sentence is represented as follows:
∀x person(X) → ¬ likes(X, sami)
• Everybody has a mother.
The above sentence is represented as follows:
∀X∃Y mother(Y, X)
• Everybody has a mother and a father.
The above sentence is represented as follows:
∀X ∃Y ∃Z mother(Y, X) ∧ father (Z, X)
• If x is a parent of y, then x is older than y.
∀X ∃Y parent(X, Y) → older (X, Y)
• If x is a mother of y, then x is parent of y.
∀X ∃Y mother (X, Y) → parent (X, Y)
Smar is the mother of Sally.
mother (smar, sally)
Then, Smar is older than Sally.
older(smar, sally)
Some more sentences
a) John likes all kind of food.
X food(X)  likes (John, X)
a) Apple and vegetable are food.
food(apple) ∧ food(vegetable)
a) Anything anyone eats and not killed is a food.
X Y eats(Y, X) ∧ ¬killed(X)  food(X)
a) Anil eats peanuts and still alive.
eats(anil, peanuts) ∧ alive(anil)
a) Harry eats everything that Anil eats.
x eats (anil, X)  eats (harry, X)
a) John likes peanuts.
b) likes (john, peanuts)
What is the answer of mapping the following
sentences into FOL using quantifiers?
• All men are mortal; Socrates is a man, therefore Socrates is mortal
Limitations of FOL
• Although first-order logic is sufficient for formalizing much of
mathematics, and is commonly used in computer science and other fields,
it has certain limitations. These include limitations on its expressiveness
and limitations of the fragments of natural languages that it can describe.

More Related Content

Similar to Ch2 (8).pptx

Similar to Ch2 (8).pptx (20)

AI Lesson 11
AI Lesson 11AI Lesson 11
AI Lesson 11
 
A course on mathematical logic
A course on mathematical logicA course on mathematical logic
A course on mathematical logic
 
Logic in Predicate and Propositional Logic
Logic in Predicate and Propositional LogicLogic in Predicate and Propositional Logic
Logic in Predicate and Propositional Logic
 
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
 
Knowledge Extraction
Knowledge ExtractionKnowledge Extraction
Knowledge Extraction
 
1.1 Basic Definitions.pptx
1.1 Basic Definitions.pptx1.1 Basic Definitions.pptx
1.1 Basic Definitions.pptx
 
d79c6256b9bdac53_20231124_093457Lp9AB.pptx
d79c6256b9bdac53_20231124_093457Lp9AB.pptxd79c6256b9bdac53_20231124_093457Lp9AB.pptx
d79c6256b9bdac53_20231124_093457Lp9AB.pptx
 
predicateLogic.ppt
predicateLogic.pptpredicateLogic.ppt
predicateLogic.ppt
 
CONTRASTIVE
CONTRASTIVECONTRASTIVE
CONTRASTIVE
 
Nlp
NlpNlp
Nlp
 
Ai lecture 09(unit03)
Ai lecture  09(unit03)Ai lecture  09(unit03)
Ai lecture 09(unit03)
 
The sentence and the utterance
The sentence and the utteranceThe sentence and the utterance
The sentence and the utterance
 
Syntax course
Syntax courseSyntax course
Syntax course
 
Lec 3.pdf
Lec 3.pdfLec 3.pdf
Lec 3.pdf
 
AI NOTES ppt 4.pdf
AI NOTES ppt 4.pdfAI NOTES ppt 4.pdf
AI NOTES ppt 4.pdf
 
Prolog final
Prolog finalProlog final
Prolog final
 
NLP_KASHK:Text Normalization
NLP_KASHK:Text NormalizationNLP_KASHK:Text Normalization
NLP_KASHK:Text Normalization
 
chapter2 Know.representation.pptx
chapter2 Know.representation.pptxchapter2 Know.representation.pptx
chapter2 Know.representation.pptx
 
Ai lecture 07(unit03)
Ai lecture  07(unit03)Ai lecture  07(unit03)
Ai lecture 07(unit03)
 
Syntactic Structures
Syntactic StructuresSyntactic Structures
Syntactic Structures
 

Recently uploaded

What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 

Recently uploaded (20)

What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 

Ch2 (8).pptx

  • 2. What is Logic ? • KBS needs to express general rules and represent specific cases. • The logic is appropriate for knowledge representation and reasoning. • ‫واالستدالل‬ ‫المعرفة‬ ‫لتمثيل‬ ‫مناسب‬ ‫المنطق‬ . • The logic is the study of entailment relations, languages, truth conditions, and rules of inference. • ‫االستدالل‬ ‫وقواعد‬ ‫الحقيقة‬ ‫وشروط‬ ‫واللغات‬ ‫االستداللية‬ ‫العالقات‬ ‫دراسة‬ ‫هو‬ ‫المنطق‬ .
  • 3. First-Order Logic (FOL) • Objects represent a set of relevant facts in a specific domain. • First-Order Logic (FOL) is a knowledge representation language used in mathematics, philosophy, linguistics, computer science, and artificial intelligence for reasoning and knowledge representation in order to express logical concepts. • First-order logic is also known as Predicate logic or First-order predicate logic. • Basically, FOL is used for representing information about the objects (entities) and the relationships between these objects.
  • 4. • We also use it for representing the rules induced from this set of objects and the relationships between them. • FOL deals with declarative propositions and uses quantifiers and relations for expressing knowledge. • FOL uses quantified variables over non-logical objects, and allows the use of sentences that contain variables, so that rather than propositions such as "Socrates is a man“, one can have expressions in the form "there exists x such that x is Socrates and x is a man", where "there exists" is a quantifier ‫المحدد‬ , while x is a variable ‫متغير‬ .
  • 5. Objects, relations, and functions • Objects: A, B, people, numbers, colors, houses, theories, games, ...... • Relations: It can be unary relation ‫احادية‬ ‫عالقة‬ such as: red, round, prime, or any relation such as: the sister of, brother of, has color, comes between, part of, owns • Function: Father of, best friend, Mother of, end of, beginning of ......
  • 6. FOL • The first-order logic language has two main parts: 1. Syntax ‫شكل‬ ‫صيغة‬ ‫الرموز‬ ‫بنية‬ 2. Semantics ‫الجملة‬ ‫سياق‬ ‫من‬ ‫المفهوم‬ ‫الرموز‬ ‫معنى‬
  • 7. 1. Syntax of FOL • The syntax of FOL is a set of logical symbols, arranged in a properly formed way. • ‫وصحيح‬ ‫جيد‬ ‫بشكل‬ ‫المرتبة‬ ‫المنطقية‬ ‫الرموز‬ ‫من‬ ‫مجموعة‬ ‫هو‬ • The syntax of FOL determines which collection of symbols is a well-formed and a logical expression in first-order logic. • ‫جيد‬ ‫بشكل‬ ‫مضاع‬ ‫منطقي‬ ‫تعبير‬ ‫تمثل‬ ‫الرموز‬ ‫من‬ ‫مجموعه‬ ‫اي‬ ‫يحدد‬ • So, we write statements in short-hand notation ‫رموز‬ in FOL using a set of logical symbols. • We know that the sentences of the language are what express propositions. ‫والفرضيات‬ ‫االقتراحات‬ ‫عن‬ ‫تعبر‬ ‫التي‬ ‫هي‬ ‫اللغة‬ ‫جمل‬
  • 8. Example of sentence syntax in general • In English language, for example: the noun phrase “the food that my mother loves” is a well-formed noun phrase. ‫صحيح‬ ‫بشكل‬ ‫ومصاغة‬ ‫مشكلة‬ ‫اسمية‬ ‫جملة‬ ‫شبة‬ ‫هي‬ • but the noun phrase “that the my loves mother food” is a not well- formed noun phrase. ‫اسمية‬ ‫جملة‬ ‫شبة‬ ‫هي‬ ‫غير‬ ‫صحيح‬ ‫بشكل‬ ‫ومصاغة‬ ‫مشكلة‬
  • 9. 2. Semantic of FOL • Semantic of FOL represents what is the well-formed expressions are supposed to mean. ‫صحيحة‬ ‫بصيغة‬ ‫المشكلة‬ ‫للجمل‬ ‫المعنى‬ • Some well-formed expressions like “the hardnosed decimal holiday” might not mean anything. • For sentences, we need to be clear about what idea that is being expressed. We must express the sentence in a meaningful way. • In English, for example, “There is someone right behind you” could be used as a warning to be careful in some contexts ‫الجمله‬ ‫سياق‬ and a request to move in others. • ‫الجملة‬ ‫سياق‬ ‫من‬ ‫يفهم‬ ‫المعنى‬
  • 10. Basic Elements of First-order logic syntax: 1. Constants 2. Variables 3. Predicates 4. Functions 5. Logical Connectives 6. Equality 7. Quantifiers 8. Punctuations 9. Well-Formed Formulas
  • 11. Constants 1, 2, A, John, Mumbai, cat,.... Variables x, y, z, a, b,.... Predicates Brother, Father, Mother, >,.... Functions sqrt, LeftLegOf, .... Connectives ∧, ∨, ¬, ⇒, ⇔ Equality == Quantifiers ∀ ‫لكل‬, ∃ ‫يوجد‬ Basic Elements of First-order logic syntax: The following are the basic elements of FOL syntax: Punctuations “(”, “)”, and “.”.
  • 12. Logical symbols • Please see the pdf file for the rest of the logical symbols and their meanings.
  • 13. Logical symbols • The logical symbol ∀ is a universal quantifier that denotes “for all” ‫لكل‬ • The logical symbol ∈, for example x ∈ A indicates that an element x is a member in a set A ‫لمجموعه‬ ‫ينتمي‬ ‫العنصر‬ • xA means that the element x is not a member in the set A • The logical symbol ∪ denotes a union ‫تكرار‬ ‫بدون‬ ‫المجموعتين‬ ‫عناصر‬ ‫لجميع‬ ‫اتحاد‬ • The logical symbol ⊨ means an implication (entailment). ‫او‬ ‫يشمل‬ ‫او‬ ‫يتضمن‬ ‫على‬ ‫ينطوي‬ ‫او‬ ‫يعني‬ • The logical symbol ⊭ indicates a negated implication. ‫اليتضمن‬ • C ⊆G, C is a subset of G, where ⊆ indicates a subset. ‫جزئية‬ ‫مجموعه‬
  • 14. Logical symbols • The logical symbol ∃ means there exists • The logical symbol ∄ means there does not exists • The logical symbol ¬ means NOT • The logical symbol ^ means AND (conjunction) • The logical symbol  means OR (disjunction) • The logical symbol  means if … then ; implies • The logical symbol  means if … then ; implies
  • 15. Logical symbols • The logical symbol  means if and only if (equivalent) • The logical symbol  means if and only if (equivalent) • The logical symbol = is logical equality • The logical symbol  means is defined as (x  y means x is defined to be another name for y) • The logical symbol ⊨ means entails ‫تتضمن‬ (x ⊨ y means x semantically entails y, A  B ⊨ ¬ B  ¬ A) • The logical symbols !, ¬, ~, x‘ means not – negation ‫نفي‬
  • 16. Logical symbols • A  B means that A is a subset of B (every element in the A set is contained in the B set). • A  B means that A is NOT a subset of B (NOT every element in the A set is contained in the B set). • ∀ and ∃ are called quantifiers.
  • 17. • Variables: an infinite supply of symbols, which we will denote here using x, y, and z. • The non-logical symbols are those that have an application- dependent meaning or use ‫التطبيق‬ ‫على‬ ‫يعتمد‬ ‫اواستخدام‬ ‫معنى‬ ‫لها‬ ‫التي‬ ‫الرموز‬ ‫هي‬. • In FOL, there are two sorts of non-logical symbols: 1. Function symbols 2. Predicate symbols
  • 18. The non-logical symbols 1. Function symbols: an infinite supply of symbols, which we will write in uncapitalized mixed case, e.g., bestFriend, and which we will denote more generally using a, b, c, f , g, and h, with subscripts and superscripts. ‫والمرتفعه‬ ‫المنخفضة‬ ‫الحروف‬ ‫مع‬ 2. Predicate symbols: an infinite supply of symbols, which we will write in capitalized mixed case, e.g., OlderThan, and which we will denote more generally using P, Q, and R, with subscripts and superscripts.
  • 19. Two types of sentences 1. Atomic sentences 2. Complex Sentences
  • 20. 1. Atomic sentences • An atomic sentence is a clause ‫الجملة‬. • A clause is a disjunction of literals ‫منفصله‬ ‫وكلمات‬ ‫حروف‬ • Atomic sentences are the basic sentences of first-order logic. These sentences are formed from a predicate symbol followed by a parenthesis ‫اقواس‬ with a sequence of terms. • We can represent atomic sentences as Predicate (term1, term2, ...., term n). • A term is a variable ‫متغير‬ or constant ‫ثابث‬ or function (Any expression f(t1,...,tn)) .
  • 21. Examples of Atomic sentences 1. Ravi and Ajay are brothers Brother(ravi, ajay). 2. Chinky is a cat cat (chinky). 3. Sally and Sara are sisters Sister(sally, sara) SALLY is a sister of Sara Predicates
  • 22. What is a predicate? • A predicate: is a relation between objects. For example: color(snow, white) The above example consists of the predicate “color” and the two (terms/arguments) “snow” and “white”. • A predicate takes an entity or entities in the domain of discourse ( ‫مجال‬ ‫)الحوار‬ as input while outputs are either True or False. • A domain of discourse specifies the range of the quantifiers.
  • 23. • Relationships between predicates can be stated using logical connectives (∧, ∨, ¬, ⇒, ⇔). • Quantifiers (∀, ∃) can be applied to variables in a formula. More examples of predicates: • color(snow, white) • color(sky, blue) • color(banana, yellow) • color(grass, green)
  • 24. 2. Complex Sentences: • Complex sentences are made by combining ‫ربط‬ atomic sentences using connectives (∧, ∨, ¬, ⇒, ⇔). First-order logic statements can be divided into two parts: • Subject: Subject is the main part of the statement. • Predicate: A predicate can be defined as a relation, which joins two atoms together in a statement.
  • 25. • Consider the statement: "x is an integer“. The above statement consists of two parts: In the first part x is the subject of the statement, and in the second part "is an integer," is the predicate. The above statement is represented in FOL as: Integer(x)
  • 26. ‫سبق‬ ‫لما‬ ‫مراجعة‬ ‫اكثر‬ ‫بشكل‬ ‫للتوضيح‬
  • 27. Quantifiers in First-order logic (FOL): • A quantifier ‫المحدد‬ is a language element which generates quantifications ‫تحديد‬ ‫الكميات‬ • Quantification specifies the quantity of specimenexamples ‫او‬ ‫مثال‬ ‫او‬ ‫عينة‬ ‫نموذج‬ in the universe of discourse‫الحوار‬ ‫عالم‬ ‫او‬ ‫مجال‬ • The universe (domain) of discourse is the complete range ‫الكامل‬ ‫النطاق‬ of objects, facts, events, attributes, relations, ideas, that are expressed, assumed, or implied in a discussion‫معين‬ ‫حوار‬ ‫او‬ ‫معين‬ ‫نقاش‬ ‫في‬ . • These are the symbols that permit to determine the range and scope of the variable in the logical expression. There are two types of quantifier: 1. Universal Quantifier, (for all, everyone, everything) 2. Existential quantifier, (for some, there is at least one, there exists).
  • 28. 1. 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 ∀ ‫لكل‬ • Note: In universal quantifier we use implication "→". • If X is a variable, then ∀X is read as: • For all X • For each X • For every X
  • 29. 1. Universal Quantifier • An example of universal quantifier: 1. All men drink coffee ∀ x man(X) → drink(X, coffee) Suppose that x is a variable which refers to a man. x1, x2, x3, x4 ∈ X ∀x man(X) → drink (X, coffee).
  • 30. 2. Existential Quantifier ∃ : • Existential quantifier is a 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 ∃ • 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 the Existential quantifier will be ∃x or ∃(x). And it will be read as: • There exists a ‘X' • For some ‘X' • For at least one ‘X'
  • 31. 2. Existential Quantifier: • An example of Existential quantifier: • some boys are intelligent. ∃X boy(X) ∧ intelligent(X) Suppose that x is a variable which represent a boy. x1, x2, x3, x4 ∈ X • ∃X: boys(X) ∧ intelligent(X)
  • 32. Points to remember: • The main connective for universal quantifier ∀ is implication →. • The main connective for existential quantifier ∃ is and ∧. Properties of Quantifiers: • In universal quantifier, ∀x∀y is similar to ∀y∀x. • In Existential quantifier, ∃x∃y is similar to ∃y∃x. • ∃x∀y is not similar to ∀y∃x.
  • 33. Some examples of mapping sentences into FOL using quantifiers: • 1. All birds fly. ∀X bird(X) → fly (X) In this question, the predicate is "fly(bird).“ Using FOL quantifier, the above sentence is represented as follows: ∀X bird(X) → fly(X).
  • 34. Some examples of mapping sentences into FOL using quantifiers: • All men are mortal (‫)بشر‬ ∀X man(X) → mortal(X) The above sentence is represented using FOL as follows: ∀X man(X) → mortal (X).
  • 35. • Every man respects his parent. ∀X man(X) → respect (X, 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).
  • 36. • 3. All boys play cricket. ∀X boy(X) → play(X , cricket) In this question, the predicate is "play(X, Y)," where x= boys, and y= cricket game. • The above sentence will be represented as: ∀X boys(X) → play(X, cricket).
  • 37. • 4. Some boys play cricket. • ∃X boy (X) ∧ play (X, cricket) In this question, the predicate is "play(X, Y)," where X= boys, and Y= cricket game. • Since there are some boys so we will use ∃, and it will be represented as: ∃X boys(X) ∧ play(X, cricket).
  • 38. • 5. Not all students like both Mathematics and Science. In this question, the predicate is "like(X, Y)," where X= student, and Y= subject which is Mathematics and Science. 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)].
  • 39. • All IT students are smart. The above sentence is represented as follows: ∀X IT_student(X) → smart (X) • Ahmad owns a car. owns(ahmad, car) The above sentence is represented as follows: owns (ahmad, car) or in general: ∀XY Owns (X, Y) Constants Variables
  • 40. • Every dog is an animal. The above sentence is represented as follows: ∀X dog(X) → animal (X) • All cats are cute. The above sentence is represented as follows: ∀X cat(X) → cute (X)
  • 41. • Every fruit is rich in vitamins. The above sentence is represented as follows: ∀X fruit(X) → is_rich (X, vitamins). • Every orange is a fruit. The above sentence is represented as follows: ∀X orange(X) → fruit(X) Then, every orange is rich in vitamins. ∀X orange(X) → is_rich (X, vitamins).
  • 42. • All frogs are green. X frog(X)  green (X) • Some frogs are green. X frog(X) ∧ green(X) Not all frogs are green. ¬ ∀ X frog(X)  green(X) • Some frogs are not green. X ( frog(X) ∧ ¬ green(X))
  • 43. • Everybody loves somebody. • Suppose that Everybody refers to X • Suppose that somebody refers to Y The above sentence is represented as follows: ∀X ∃Y loves(X, Y). • Cat of Sami is cute. isCute(catOf(sami)) The above sentence is represented as follows: isCute (catOf(Sami))
  • 44. • Some dogs are pets. (‫اليفة‬ ‫)حيوانات‬ X dog(X) ∧ pets(X) The above sentence is represented as follows: ∃X dog(X) ∧ pet (X)
  • 45. • Brothers are siblings (‫اشقاء‬ ‫هم‬ ‫)االخوة‬. • X  Y brother (X, Y)  sibling( X, Y) • Mother is one female parent. • X Y mother(X, Y)  female(X) ∧ parent (X, Y) • Father is one male parent. • X  Y father(X, Y)  male (X) ∧ parent (X, Y)
  • 46. • A cousin is a child of a parent’s sibling. ‫الوالدين‬ ‫احد‬ ‫شقيق‬ ‫ابن‬ ‫هو‬ ‫العم‬ ‫ابن‬ The above sentence is represented as follows: ∀X ∀Y cousin (X, Y) → ∃ Z, F parent (Z, X) ∧ sibling (Z, F) ∧ parent (F, Y) • For every computer virus, there is an anti-virus program that kills it. • Suppose computer virus refers to X • Suppose antivirus refers to Y  X  Y kills( Y, X)
  • 47. • All students studying AI are genius. X student (X) ∧ studyingAI(X) → genius(X) The above sentence is represented as follows: • Some students studying AI are genius and homeworking.  X student(X) ∧ studyingAI(X) ∧ genius(X) ∧ homeworking(X) The above sentence is represented as follows: ∃x student(X) ∧ studyingAI (X) ∧ genius(X) ∧ homeworking(X)
  • 48. • No one likes Sami. The above sentence is represented as follows: ∀x person(X) → ¬ likes(X, sami) • Everybody has a mother. The above sentence is represented as follows: ∀X∃Y mother(Y, X) • Everybody has a mother and a father. The above sentence is represented as follows: ∀X ∃Y ∃Z mother(Y, X) ∧ father (Z, X)
  • 49. • If x is a parent of y, then x is older than y. ∀X ∃Y parent(X, Y) → older (X, Y) • If x is a mother of y, then x is parent of y. ∀X ∃Y mother (X, Y) → parent (X, Y) Smar is the mother of Sally. mother (smar, sally) Then, Smar is older than Sally. older(smar, sally)
  • 50. Some more sentences a) John likes all kind of food. X food(X)  likes (John, X) a) Apple and vegetable are food. food(apple) ∧ food(vegetable) a) Anything anyone eats and not killed is a food. X Y eats(Y, X) ∧ ¬killed(X)  food(X) a) Anil eats peanuts and still alive. eats(anil, peanuts) ∧ alive(anil) a) Harry eats everything that Anil eats. x eats (anil, X)  eats (harry, X) a) John likes peanuts. b) likes (john, peanuts)
  • 51.
  • 52. What is the answer of mapping the following sentences into FOL using quantifiers? • All men are mortal; Socrates is a man, therefore Socrates is mortal
  • 53. Limitations of FOL • Although first-order logic is sufficient for formalizing much of mathematics, and is commonly used in computer science and other fields, it has certain limitations. These include limitations on its expressiveness and limitations of the fragments of natural languages that it can describe.