Year 20 1 3 LECTURE 07 First Order Logic 2 Introduction to FirstOrder Logic Syntax and Semantics of FirstOrder Logic Using FirstOrder Logic Proof by Resolution Knowledge Engineering in FirstOrder Logic ID: 760356
Download Presentation The PPT/PDF document "Course : T 0264 – Artificial Intellig..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Course : T0264 – Artificial IntelligenceYear : 2013
LECTURE 07
First Order
Logic
Slide22
Introduction to First-Order LogicSyntax and Semantics of First-Order LogicUsing First-Order LogicProof by ResolutionKnowledge Engineering in First-Order LogicSummary
T0264 - Artificial Intelligence
Outline
Slide3Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes the world contains:Objects: people, houses, numbers, colors, baseball games, wars, …Relations: red, round, prime, brother of, bigger than, part of, comes between, …Functions: father of, best friend, one more than, plus, …
3
T0264 - Artificial Intelligence
Introduction to
First-Order Logic
Slide4 = For all ; [e.g : every one, every body, any time, etc] = There exists ; [e.g : some one, some time, etc] = Implication ; [ if … then ….] = Equivalent ; biconditional [if … and … only … if …] = Not ; negation = OR ; disjunction = AND ; conjunction
T0264 - Artificial Intelligence
4
Standard Logic Symbols
Introduction to
First-Order Logic
Slide5Model for First-Order LogicSymbol and RepresentationsVariables x, y, a, b,...Connectives , , , , Equality = Quantifiers ,
5
T0264 - Artificial Intelligence
Syntax and Semantics
of First-Order Logic
Slide66
T0264 - Artificial Intelligence
Models for FOL: Example
Syntax and Semantics
of First-Order Logic
Slide7Atomic Sentences
Atomic sentence = predicate (term1,...,termn) or term1 = term2 “Richard the Lionheart is the brother of King John”. e.g., Brother(Richard, John) Complex terms as arguments in atomic sentences is : married (Father(Richard), Mother(John)) An atomic sentence is true in a given model if the relation referred to by the predicate symbol holds among the objects referred to by the arguments.
7
T0264 - Artificial Intelligence
Syntax and Semantics
of First-Order Logic
Slide8Complex Sentences
Complex sentences are made from atomic sentences using connectives : “All King are person” written as : x : King(x) Person(x) “King John has a crown on his head” written as : y :Crown(y) OnHead(y, John)More complex sentences using multiple quantifier : p q : Brother (p, q) Sibling(p, q)Symmetric relationship : p q : Sibling(p, q) Sibling(q, p) e.g. Sibling(King John, Richard) Sibling(Richard, King John)
8
T0264 - Artificial Intelligence
Syntax and Semantics
of First-Order Logic
Slide99
Sentences :Chandra is a student Chandra is student in computer scienceEach computer science student is member of school of computer Algorithm is difficult Each student in school of computer is like or hate the algorithm Each student is like one lesson The student which do not come to in difficult lesson, there are dislike to these lesson Chandra not come in algorithm
T0264 - Artificial Intelligence
Using
First-Order Logic
Slide1010
Change to First-Order Logic
Student (Chandra)Student (Chandra, computer_science)x : student(x) computer_science(x) member (x, school_of_computer)Difficult(Algorithm)x : student(x, computer_science) like(x, Algorithm) hate(x, Algorithm)x :y : like(x, y)x : y : student(x) difficult(y) come(x, y) like(x, y)8. come(Chandra, Algorithm)
T0264 - Artificial Intelligence
Using
First-Order Logic
Slide1111
Does Chandra like Algorithm?by backward chaining
like(Chandra, algorithm)
(8)
null
student(Chandra
) difficult(algorithm) come (Chandra, algorithm)
difficult(algorithm) come(Chandra, algorithm)
come(Chandra, algorithm)
(4)
(1)
(7)
T0264 - Artificial Intelligence
Using
First-Order Logic
Slide12T0264 - Artificial Intelligence
12
Proof by Resolution
Inference procedure based on resolution work by using the principle of proof by
contradiction.
That is, to show that
KB
├
=
, we show that
(KB
)
is unsatisfied. We do this by contradiction.
See Resolution Algorithm
Therefore:
First : (KB
) is convert into CNF (normal clause form)
Second : show clauses obtained by resolving pairs in the row
13
Algorithm : Resolution
Convert all the proposition logic to normal clause form (CNF).Negate P and convert the result to clause form. Add it to the set of clause in step Repeat until either a contradiction is found or no progress can be made, or a predetermined amount of effort has been expended. Select two clause. Call these the parent clauses.Resolve them together. The resolvent will be the disjunction of all of the literals of both parent clauses with appropriate substitutions performed and with the following exception: If there is one pairs of literals T1 and T2 such that one of the parent clauses contains T1 and the other contains T2 and if T1 and T2 are unifiable, then neither T1 nor T2 should appear in the resolvent. If there is more than one pair of complementary literals, only one pair should be omitted from the resolvent.
T0264 - Artificial Intelligence
Proof by Resolution
Slide1414
Algorithm : Resolution
If the resolvent is the empty clause, then a contradiction has been found. If it is not, then add it to the set of clause available to the procedure.A simple pseudo code resolution algorithm for proportional logic
T0264 - Artificial Intelligence
Proof by Resolution
Slide1515
Conversion to Normal Clause Form (CNF Algorithm)
Eliminate , using : a b = a b.Reduce the scope of each to a single term, using de Morgan’s laws: (p) = p (ab) = a b (ab) = a b x : P(x) =x : P(x) x : P(x) = x : P(x)3. Standardize variables.For sentences like (∀x P(x)) ∨ (∃x Q(x)) which use the same variable name twice, change the name of one of the variables. This avoids confusion later when we drop the quantifiers. For example, from ∀x [∃y Animal(y) ∧ ¬Loves(x, y)] ∨ [∃y Loves(y, x)]. we obtain: ∀x [∃y Animal(y) ∧ ¬Loves(x, y)] ∨ [∃z Loves(z, x)].
T0264 - Artificial Intelligence
Proof by Resolution
Slide1616
Convert to Normal Clause Form (cont’d)
T0264 - Artificial Intelligence
Proof by Resolution
Move all quantifiers to the left of the formula without changing their relative order.
Eliminate
existential quantifiers by
inserting
Skolem
functions.
∃x P(x) into P(A), where A is a new constant
Drop universal quantifiers
Convert
the matrix into a
conjunction
of
disjoints,
using
associativity
and
distributivity
(
d
istribute ORs over ANDs
)
Slide1717
Resolution Example
Representation in CNF: student(Chandra)computer_science(Chandra)computer_science(x1) v school_of_computer(x1)difficult(Algorithm)school_of_computer(x2) v like(x2,Algorithm) v hate(x2,Algorithm)like(x3,f(x3))student(x4) v difficult(y1) v come(x4,y1) v like(x4,y1)come(Chandra, Algorithm)
T0264 - Artificial Intelligence
Proof by Resolution
Slide1818
Show that:Chandra hate Algorithmby Resolution
difficult
(Algoritma) v come(Chandra,Algorithm)
come(Chandra, Algorithm)
null
2
4
8
1
student(Chandra) v
difficult
(Algorithm) v come(Chandra,Algorithm)
like(Chandra,Algorithm)
Chandra/x4 ; Algoritma/y1
7
computer_science(Chandra) v
like
(Chandra,Algorithm)
school_of_computer(Chandra) v
like
(Chandra,Algorithm)
3
hate(Chandra,
Algorithm)
5
Chandra/x2
Chandra/x1
T0264 - Artificial Intelligence
Proof by Resolution
Slide19The Knowledge Engineering Process Identify the taskAssemble the relevant knowledgeDecide on a vocabulary of predicates, functions, and constantsEncode general knowledge about a domainEncode a description of the specific problem instancePose queries to the inference procedure and get answersDebug the knowledge base
T0264 - Artificial Intelligence
19
Knowledge
Engineering
i
n First-Order Logic
Slide20Seven Basic Gate
ABANDORNANDNORXORXNORNOT BBufferB = X0000110110010110100-10011010- -11110001 -1
T0264 - Artificial Intelligence
20
Knowledge
Engineering
i
n First-Order Logic
Slide21A digital circuit C1, purporting to be a one-bit full adder.
The first two inputs are the two bit to be added, and the third input is a carry bit.The first output is the sum, and the second output is a carry bit for the next adder.
21
T0264 - Artificial Intelligence
The Electronic Circuit Domain
Knowledge
Engineering
i
n First-Order Logic
Slide22In Boolean representation as : Or Logic Circuit
T0264 - Artificial Intelligence
22
The Electronic Circuit Domain
Knowledge
Engineering
i
n First-Order Logic
Slide23Integrated Circuit (IC)
T0264 - Artificial Intelligence
23
Knowledge
Engineering
i
n First-Order Logic
Slide24Resolution is complete for propositional logicForward, backward chaining are linear-time, complete for Horn clausesPropositional logic lacks expressive powerFirst-order logic:objects and relations are semantic primitivessyntax: constants, functions, predicates, equality, quantifiersIncreased expressive power: sufficient to define wumpus world
24
T0264 - Artificial Intelligence
Summary
Slide25Next Presentations(1 group-6 persons)
Adversarial SearchClassical PlanningPlanning and Acting in the Real WorldProbabilistic Reasoning and Over TimeMaking simple and Complex DecisionLearning from ExamplesReinforcement LearningNatural Language ProcessingDeep LearningPerception and Robotics
T0264 - Artificial Intelligence
25