0% found this document useful (0 votes)
2 views

using-predicate-logic

First-order logic (FOL) is an advanced form of knowledge representation in artificial intelligence, extending propositional logic to express relationships and properties of objects. It utilizes quantifiers, such as universal and existential, to articulate statements about objects and their relationships, and includes concepts like 'IsA' and 'instance' for hierarchical representation. The document also covers algorithms for converting logical expressions to clause form and resolution for proving facts and answering queries.

Uploaded by

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

using-predicate-logic

First-order logic (FOL) is an advanced form of knowledge representation in artificial intelligence, extending propositional logic to express relationships and properties of objects. It utilizes quantifiers, such as universal and existential, to articulate statements about objects and their relationships, and includes concepts like 'IsA' and 'instance' for hierarchical representation. The document also covers algorithms for converting logical expressions to clause form and resolution for proving facts and answering queries.

Uploaded by

pappi badiger
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

RepresentingSimpleFactsInLogic

First-OrderLogic

• First-orderlogicisanotherwayofknowledgerepresentationin
artificial intelligence. It is an extension to propositional logic.
• FOL is sufficiently expressive to represent the natural
language statements in a concise way.
• First-order logic is also known as Predicate logic or First-
orderpredicatelogic.First-orderlogicisapowerfullanguage
thatdevelopsinformationabouttheobjectsinamoreeasyway and
can also express the relationship between those objects.
• First-order logic (like natural language) does not only assume
that the world contains facts like propositional logic but also
assumes the following things in the world:
• Objects: A, B, people, numbers, colors, wars, theories,
squares, pits, ......
• Relations: It can be unaryrelationsuchas: red,round,is
adjacent, or n-any relation such as: the sister of, brother
of, has color, comes between
• Function:Fatherof,bestfriend,thirdinningof,endof,
......
• A quantifier is a language element which generates
quantification, and quantification specifies the quantity of
specimen in the universe of discourse.
• These are the symbols that permit to determine or identify the
range and scope of the variable in the logical expression.
1. UniversalQuantifier,(forall,everyone,everything)
2. Existentialquantifier,(forsome,atleastone).
1. Universal Quantifier
• Universal quantifier is a symbol of logical representation,
which specifies that the statement within its range is true for

• The Universal quantifier is represented by a symbol ∀, which


everything or every instance of a particular thing.

resembles an inverted A.
• Note:Inuniversalquantifierweuseimplication"→".
• Ifxis avariable,then∀x isreadas:
• Forallx
• Foreachx
• Foreveryx.
Ex-
Allman drink coffee.
∀xman(x)→drink(x,coffee).
2. ExistentialQuantifier
• Existential quantifiers are the type of quantifiers, which
express that the statement within its scope is true for at least

• It is denoted by the logical operator ∃, which resembles as


one instance of something.

inverted E. When it is used with a predicate variable then it is

• If x is a variable, then existential quantifier will be ∃x or ∃(x).


called as an existential quantifier.

And it will be read as:


• Thereexistsa'x.'
• Forsome'x.'
• Foratleastone'x.„
Ex-
Someboysare intelligent.
∃x:boys(x)∧intelligent(x)
1. Marcuswasa man.
Man(Marcus).

2. MarcuswasaPompeian.
Pompeian(Marcus).

∀x:Pompeian(x) ->Roman(x).
3. AllPompeianswere Romans.

4. Caesarwasa ruler.
Ruler(Caesar).

∀x:Roman(y)->(LoyalTo(x,Caesar)∨Hate(x,Caesar))
5. AllRomanswereeitherloyaltoCaesar orhated him.
∀x :->y :LoyalTo(x,y)
6. Everyoneisloyaltosomeone.

∀x:∀y:Person(x)∧Ruler(y)∧TryAssassinate(x,y))->
7. Peopleonlytrytoassassinaterulerstheyaren'tloyalto.

¬LoyalTo(x,y)

8. MarcustriedtoassassinateCaesar.
TryAssassinate(Marcus,Caesar).
RepresentingInstanceandIsaRelationships
• Logic statements, containing subject, predicate, and object,
were explained. Also stated, twoimportantattributes "instance"
and "isa", ina hierarchical structure.

• Attributes “ IsA ” and “ Instance ” support property


inheritance and play important role in knowledge
representation.

• The ways these two attributes "instance" and "isa", are


logically expressed are shown in the example below :

Ex-
Asimplesentencelike"Joe isa musician"

• Here "is a"(calledIsA)isawayofexpressingwhat logically is


called a class-instance relationship between the subjects
represented by the terms "Joe" and "musician".

• "Joe" is an instance of the class of things called "musician".


"Joe" plays the role of instance,

• "musician"playstheroleof classin thatsentence.


ComputableFunctionsandPredicates

• Itmay be necessary to computefunctions as partof a fact.


Inthese cases a computable predicate is used.
• Acomputablepredicatemayincludecomputablefunctions
suchas+, -,*,etc.
• Forexample,gt(x-y,10)→bigger(x)containsthecomputable
predicate gt which performs the greater than function.

Ex-
1. Marcuswasaman.
man(Marcus).

2. Marcuswas Pompeian.
Pompeian(Marcus).
3. Marcuswasbornin40A.D.
born(Marcus,40).

∀x:man(x) →mortal(x).
4. Allmenaremortal.

5. All Pompeians died when the volcano erupted in 79A.D.


erupted(volcano,79)/\∀x:Pompeian(x)→died(x,79).

∀x∀t1∀t2:mortal(x)/\born(x,t1)/\gt(t2-t1,150)→ dead(x,t2)
6. Nomortalliveslongerthan150 years.
7. Itisnow1991.
now=1991.

∀x ∀t: [alive(x,t)
8. Alivemeansnotdead.
→ ~dead(x,t)] /\ [~dead(x,t)
→alive(x,t)]

∀x∀t1∀t2:died(x,t1)/\gt(t2,t1)→dead(x,t2).
9. Ifsomeonedies,heis deadatalllatertimes.
Ex-“IsMarcusalivenow?”.
~alive(Marcus,now)
↓8
~[~dead(Marcus,now)]
↓negationoperation
dead(Marcus,now)
↓9
died(Marcus,t1)/\gt(now,t1)
↓5
erupted(volcano,79)/\Pompeian(Marcus)/\gt(now,79)
↓fact,2
gt(now,79)

gt(1991,79)
↓computegt nil
Resolution
• Resolution proves facts and answers queries by refutation. This
involves assuming the fact/query is untrue and reaching a
contradiction which indicates that the oppositemust be true. The
wffs must firstly be firstly converted to clause form before using
resolution.

Algorithm:ConvertingwffstoClauseForm
1. Remove all implies, i.e. → by applying the following: a → b is
equivalent to ~a \/ b.

2. Usethefollowingrulestoreducethescopeofeachnegationoperator
to a single term:
• ~(~a)= a
• ~(a/\b)= ~a\/~b
• ~(a\/b)= ~a/\~b
~∀x: p(x)=∃x:~p(x)
~∃x:p(x)=∀x:~p(x)

example, consider ∀x: p(x) \/ ∀x: q(x).Inthis both quantifiers


3. Each quantifier must be linked to a unique variable. For

variable: ∀x: p(x) \/ ∀y: q(y).


are using the same variable and one must changed to another

4. Moveallquantifiers,inorder,totheleftofeach wff.

functions. For example, ∃x: p(x) becomes p(s1) and ∀x ∃y:


5. Remove existential quantifiers by using Skolem constants or

q(x,y) is replaced with ∀x: q(s2(x), x).

6. Drop thequantifierprefix.
7. Apply the associative property of disjunctions: a \/ (b \/ c) =(a
\/ b) \/ c and remove brackets giving a \/ b \/ c.

8. Remove all disjunctions of conjunctions from predicates, i.e.


create conjunctions of disjunctions instead, by applying the
following rule iteratively: (a /\ b) \/ c = (a \/ c) /\ (b \/ c).

9. Createaseparateclausefor eachconjunction.

10. Rename variables in the clauses resulting from step 9. to


ensure that no two clauses refer to the same variable.
Algorithm:Resolution

1. Convertthewffs toclauseform.

2. Addthefact(orquery)Ptobeproved tothesetof clauses:


i. NegateP.
ii. ConvertnegatedPtoclause form.
iii. Addtheresultof iitothesetof clauses.

3. Repeat
i. Selecttwo clauses.
ii. Resolvetheclausesusingunification.
iii. If the resolvent clause is the empty clause, then a
contradiction has been reached. If not add the resolvent to
the set of clauses.
Consider thefollowing wffs:
1. man(Marcus).
man(Marcus).

2. Pompeian(Marcus).
Pompeian(Marcus).

3. ∀x:Pompeian(x) →Roman(x).
~Pompeian(x)\/Roman(x).

4. ruler(Caesar).
ruler(Caesar).

5. ∀x:Roman(x)→loyalto(x,Caesar)\/hate(x,Caesar).
~Roman(x1)\/loyalto(x1,Caesar)\/hate(x1,Caesar).
6. ∀x∃y:loyalto(x,y)
loyalto(x2,s1(x2))

7. ∀x ∀y: person(x) /\ ruler(y) /\ tryassassinate(x,y) →


~loyalto(x,y)
~person(x3) \/ ~ruler(y) \/ ~tryassassinate(x3,y) \/
~loyalto(x3,y)

8. tryassassinate(Marcus,Caesar).
tryassassinate(Marcus,Caesar).

9. ∀x:man(x) →person(x)
~man(x4)\/person(x4)
• wewant toprovethatMarcushatesCaesar.

• Wefirstlyconvertthistoawff:hate(Marcus,Caesar).

• The wff is then negated and converted to clause form:


~hate(Marcus,Caesar).

• This clause is added to the set of clauses and the resolution


isalgorithm is applied:
~hate(Marcus,Caesar)
↓5
~Roman(Marcus)\/loyalto(x1,Caesar)
↓3
~Pompeian(Marcus)\/loyalto(Marcus,Caesar)
↓2
loyalto(Marcus,Caesar)
↓7
~person(Marcus)\/~ruler(Caesar)\/~tryassassinate(Marcus,Caesar)
↓4
~person(Marcus)\/~tryassassinate(Marcus,Caesar)
↓8
~person(Marcus)
↓9
~man(Marcus)
↓1

You might also like