+ All Categories
Home > Documents > First Order Logic (FOL) -...

First Order Logic (FOL) -...

Date post: 30-Sep-2018
Category:
Upload: phamnguyet
View: 218 times
Download: 0 times
Share this document with a friend
27
First Order Logic (FOL) CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2017 Soleymani β€œArtificial Intelligence: A Modern Approach”, 3 rd Edition, Chapter 8
Transcript

First Order Logic (FOL)CE417: Introduction to Artificial IntelligenceSharif University of TechnologySpring 2017

Soleymani

β€œArtificial Intelligence: A Modern Approach”, 3rd Edition, Chapter 8

Why FOL?

2

To represent knowledge of complex environments concisely

Expressive enough to represent a good deal of of our knowledge

E.g., β€œpits cause breezes in adjacent squares” needs many rules in

propositional logic but one rule in FOL

Natural language elements & FOL elements

Some basic elements of natural language (included also in FOL):

Nouns and noun phrases referring to objects (squares, pits, wumpus)

Some of objects are defined as functions of other objects

Verbs and verb phrases referring to relation among objects (is breezy,is adjacent to, shoot)

Examples:

Objects: people, houses, numbers, baseball games,…

Relations

Unary relation or property: red, round, prime,…

𝑛-ary: brother of, bigger than, inside, part of, owns, comes between,…

Functions: father of, best friend, one more than, beginning of,…

FOL does not include all elements of natural language.

3

Symbols & interpretations

Types of symbols

Constant for objects

Predicate for relations

Function for functional relations

4

Example

5

π΅π‘Ÿπ‘œπ‘‘β„Žπ‘’π‘Ÿ(π‘…π‘–π‘β„Žπ‘Žπ‘Ÿπ‘‘, π½π‘œβ„Žπ‘›)

πΉπ‘Žπ‘‘β„Žπ‘’π‘Ÿ(π½π‘œβ„Žπ‘›) = π»π‘’π‘›π‘Ÿπ‘¦

π‘€π‘Žπ‘Ÿπ‘Ÿπ‘–π‘’π‘‘(πΉπ‘Žπ‘‘β„Žπ‘’π‘Ÿ(π‘…π‘–π‘β„Žπ‘Žπ‘Ÿπ‘‘), π‘€π‘œπ‘‘β„Žπ‘’π‘Ÿ(π½π‘œβ„Žπ‘›))

βˆ€π‘₯ 𝐾𝑖𝑛𝑔 π‘₯ β‡’ π‘ƒπ‘’π‘Ÿπ‘ π‘œπ‘› π‘₯

βˆƒπ‘₯ πΆπ‘Ÿπ‘œπ‘€π‘› π‘₯ β‡’ π‘‚π‘›π»π‘’π‘Žπ‘‘ π‘₯, π½π‘œβ„Žπ‘›

βˆƒπ‘₯, 𝑦 π΅π‘Ÿπ‘œπ‘‘β„Žπ‘’π‘Ÿ π‘₯, π‘…π‘–π‘β„Žπ‘Žπ‘Ÿπ‘‘ ∧ π΅π‘Ÿπ‘œπ‘‘β„Žπ‘’π‘Ÿ 𝑦, π‘…π‘–π‘β„Žπ‘Žπ‘Ÿπ‘‘ ∧ Β¬(π‘₯ = 𝑦)

¬𝐾𝑖𝑛𝑔(π‘…π‘–π‘β„Žπ‘Žπ‘Ÿπ‘‘) β‡’ 𝐾𝑖𝑛𝑔(π½π‘œβ„Žπ‘›)

π‘₯, 𝑦 𝑆𝑖𝑏𝑙𝑖𝑛𝑔(π‘₯, 𝑦) [ π‘₯ = 𝑦 βˆƒπ‘š, 𝑓 (π‘š = 𝑓) π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘(π‘š, π‘₯) π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘(𝑓, π‘₯) π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘(π‘š, 𝑦) π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘(𝑓, 𝑦)]

Syntax of FOL: Basic elements

Logical elements

Connectives ,,,,

Quantifiers ,

Domain specific elements

Constants π½π‘œβ„Žπ‘›, π‘…π‘–π‘β„Žπ‘Žπ‘Ÿπ‘‘, …

Predicates π΅π‘Ÿπ‘œπ‘‘β„Žπ‘’π‘Ÿ, ...

Functions 𝐿𝑒𝑓𝑑𝐿𝑒𝑔𝑂𝑓,...

Non-logical general elements

Variables π‘₯, 𝑦, π‘Ž, 𝑏, …

Equality =

6

Syntax of FOL: Atomic sentences

Atomic Sentence β†’ Predicate | Predicate (Term,…, Term) |Term=Term

Term β†’ Constant| variable| Function(Term,…)

Constant β†’ Richard |A | X1|…

Variable β†’ a | x | s | …

Function β†’ Mother | LeftLeg |…

Predicate β†’ True | False | After | Loves | Hascolor | ….

7

ObjectRelation

1) π΅π‘Ÿπ‘œπ‘‘β„Žπ‘’π‘Ÿ(π‘…π‘–π‘β„Žπ‘Žπ‘Ÿπ‘‘, π½π‘œβ„Žπ‘›)

2) πΉπ‘Žπ‘‘β„Žπ‘’π‘Ÿ(π½π‘œβ„Žπ‘›) = π»π‘’π‘›π‘Ÿπ‘¦

3) π‘€π‘Žπ‘Ÿπ‘Ÿπ‘–π‘’π‘‘(πΉπ‘Žπ‘‘β„Žπ‘’π‘Ÿ(π‘…π‘–π‘β„Žπ‘Žπ‘Ÿπ‘‘), π‘€π‘œπ‘‘β„Žπ‘’π‘Ÿ(π½π‘œβ„Žπ‘›))

Syntax of FOL (BNF Grammar)

8

Sentence β†’ Atomic Sentence | ComplexSentenceAtomic Sentence β†’ Predicate | Predicate (Term,…, Term) |Term=Term

ComplexSentence β†’ ( Sentence ) | Β¬ Sentence

| Sentence ∧ Sentence | Sentence ∨ Sentence| Sentence Sentence | Sentence ⇔ Sentence| Quantifier variable, …Sentence

Term β†’ Function(Term,…)

| Constant| variable

Quantifier β†’ βˆ€ | βˆƒ

Constant β†’ A | X1…

Variable β†’ a | x | s | …

Predicate β†’ True | False | After | Loves | Hascolor | ….

Function β†’ Mother | LeftLeg |…

π‘‚π‘π‘’π‘Ÿπ‘Žπ‘‘π‘œπ‘Ÿ π‘ƒπ‘Ÿπ‘’π‘π‘’π‘‘π‘’π‘›π‘π‘’: Β¬, =,∧,∨, β‡’, ⟺

Universal quantification

π‘₯ 𝑃(π‘₯) is true in a model π‘š iff 𝑃(π‘₯) is true with π‘₯ beingeach possible object in the model

conjunction of instantiations of 𝑃(π‘₯)

9

Existential quantification

π‘₯ 𝑃(π‘₯) is true in a model π‘š iff 𝑃(π‘₯) is true with π‘₯ beingsome possible object in the model

disjunction of instantiations of 𝑃(π‘₯)

10

Properties of quantifiers

π‘₯ 𝑦 𝑃 is the same as 𝑦 π‘₯ 𝑃 π‘₯ 𝑦 𝑃 is the same as 𝑦 π‘₯ 𝑃 π‘₯ 𝑦 𝑃 is not the same as 𝑦 π‘₯ 𝑃

π‘₯ 𝑦 π‘€π‘œπ‘‘β„Žπ‘’π‘Ÿ(π‘₯, 𝑦) β€œThere is a person who is mother of everyone in the world”

𝑦 π‘₯ π‘€π‘œπ‘‘β„Žπ‘’π‘Ÿ(π‘₯, 𝑦) β€œEveryone in the world has a mother”

Quantifier duality π‘₯ 𝑃 ⇔ π‘₯𝑃 π‘₯ 𝑃 ⇔ Β¬βˆ€π‘₯ 𝑃

11

FOL: Kinship domain example

Objects people

Functions

Predicates

12

FOL: Kinship domain example

Objects: people

Functions:π‘€π‘œπ‘‘β„Žπ‘’π‘Ÿ, πΉπ‘Žπ‘‘β„Žπ‘’π‘Ÿ

Predicates:

Unary:π‘€π‘Žπ‘™π‘’, πΉπ‘’π‘šπ‘Žπ‘™π‘’

Binary:π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘, 𝑆𝑖𝑏𝑙𝑖𝑛𝑔, π΅π‘Ÿπ‘œπ‘‘β„Žπ‘’π‘Ÿ, π‘†π‘–π‘ π‘‘π‘’π‘Ÿ, πΆβ„Žπ‘–π‘™π‘‘, π·π‘Žπ‘’π‘”β„Žπ‘‘π‘’π‘Ÿ, π‘†π‘œπ‘›, π‘†π‘π‘œπ‘’π‘ π‘’,

π‘Šπ‘–π‘“π‘’, π»π‘’π‘ π‘π‘Žπ‘›π‘‘, πΊπ‘Ÿπ‘Žπ‘›π‘‘π‘π‘Žπ‘Ÿπ‘’π‘›π‘‘, πΊπ‘Ÿπ‘Žπ‘›π‘‘π‘β„Žπ‘–π‘™π‘‘, πΆπ‘œπ‘’π‘ π‘–π‘›, 𝐴𝑒𝑛𝑑, π‘ˆπ‘›π‘π‘™π‘’

13

FOL: Kinship domain example

14

Sample sentences:

π‘š, 𝑐 π‘€π‘œπ‘‘β„Žπ‘’π‘Ÿ 𝑐 = π‘š ⇔ (πΉπ‘’π‘šπ‘Žπ‘™π‘’(π‘š) ∧ π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘(π‘š, 𝑐))

𝑝, 𝑐 π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘ 𝑝, 𝑐 ⇔ πΆβ„Žπ‘–π‘™π‘‘(𝑐, 𝑝)

𝑔, 𝑐 πΊπ‘Ÿπ‘Žπ‘›π‘‘π‘π‘Žπ‘Ÿπ‘’π‘›π‘‘ 𝑔, 𝑐 ⇔ βˆƒπ‘ π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘ 𝑔, 𝑝 ∧ π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘ 𝑝, 𝑐

π‘₯, 𝑦 𝑆𝑖𝑏𝑖𝑙𝑖𝑛𝑔 π‘₯, 𝑦 ⇔ π‘₯ β‰  𝑦 ∧ βˆƒπ‘ π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘ 𝑝, π‘₯ ∧ π‘ƒπ‘Žπ‘Ÿπ‘’π‘›π‘‘ 𝑝, π‘₯

Assertions & queries in FOL KBs

Assertions: sentences added to 𝐾𝐡 using 𝑇𝐸𝐿𝐿

𝑇𝑒𝑙𝑙(𝐾𝐡, 𝐾𝑖𝑛𝑔(π½π‘œβ„Žπ‘›))

𝑇𝑒𝑙𝑙(𝐾𝐡, (βˆ€π‘₯ 𝐾𝑖𝑛𝑔 π‘₯ β‡’ π‘ƒπ‘’π‘Ÿπ‘ π‘œπ‘› π‘₯ ))

Queries or goals: questions asked from 𝐾𝐡 using 𝐴𝑆𝐾

𝐴𝑆𝐾 𝐾𝐡, 𝐾𝑖𝑛𝑔 π½π‘œβ„Žπ‘›

𝐴𝑆𝐾 𝐾𝐡, βˆƒπ‘₯ 𝐾𝑖𝑛𝑔 π‘₯

Substitution or binding list:AskVars

In KB of Horn clauses, every way of making the query true will bind thevariables to specific values

AskVars(𝐾𝐡, 𝐾𝑖𝑛𝑔(π‘₯)): answer {π‘₯/π½π‘œβ„Žπ‘›}

If KB contains 𝐾𝑖𝑛𝑔 π½π‘œβ„Žπ‘› ∨ 𝐾𝑖𝑛𝑔(π‘…π‘–π‘β„Žπ‘Žπ‘Ÿπ‘‘), there is no binding although𝐴𝑆𝐾 𝐾𝐡, βˆƒπ‘₯ 𝐾𝑖𝑛𝑔 π‘₯ is true

15

FOL: Set domain example

16

Objects: sets, elements

Functions: 𝑠1 ∩ 𝑠2, 𝑠1 βˆͺ 𝑠2, {π‘₯|𝑠}

Predicates: Unary: Set

Binary: π‘₯ ∈ 𝑠, 𝑠1 βŠ† 𝑠2

𝑠 𝑆𝑒𝑑(𝑠) ⇔ (𝑠 = {}) ∨ (βˆƒπ‘₯, 𝑠2 𝑆𝑒𝑑(𝑠2) 𝑠 = {π‘₯|𝑠2})

π‘₯, 𝑠 {π‘₯|𝑠} = {} π‘₯, 𝑠 π‘₯ ∈ 𝑠 ⇔ 𝑠 = {π‘₯|𝑠}

π‘₯, 𝑠 π‘₯ ∈ 𝑠 ⇔ βˆƒπ‘¦, 𝑠2 (𝑠 = {𝑦|𝑠2} (π‘₯ = 𝑦 ∨ π‘₯ ∈ 𝑠2))] 𝑠1, 𝑠2 𝑠1𝑠2 (π‘₯ π‘₯𝑠1 π‘₯ ∈ 𝑠2) 𝑠1, 𝑠2 (𝑠1 = 𝑠2) (𝑠1 𝑠2 𝑠2 𝑠1) π‘₯, 𝑠1, 𝑠2 π‘₯ ∈ (𝑠1𝑠2) (π‘₯ ∈ 𝑠1 π‘₯ ∈ 𝑠2)

π‘₯, 𝑠1, 𝑠2 π‘₯ ∈ (𝑠1𝑠2) (π‘₯ ∈ 𝑠1 π‘₯ ∈ 𝑠2)

FOL: Wumpus world example

17

Environment

Objects: pairs identifying squares [𝑖, 𝑗], 𝐴𝑔𝑒𝑛𝑑, π‘Šπ‘’π‘šπ‘π‘’π‘ 

Relations:𝑃𝑖𝑑, π΄π‘‘π‘—π‘Žπ‘π‘’π‘›π‘‘, π΅π‘Ÿπ‘’π‘’π‘§π‘¦, π‘†π‘‘π‘’π‘›π‘β„Žπ‘¦,

π‘ƒπ‘’π‘Ÿπ‘π‘’π‘π‘‘, π΄π‘π‘‘π‘–π‘œπ‘›, 𝐴𝑑, π»π‘Žπ‘£π‘’π΄π‘Ÿπ‘Ÿπ‘œπ‘€, …

FOL: Wumpus world example

Perceptions: perceives a smell, a breeze, and glitter at 𝑑 = 5:

π‘ƒπ‘’π‘Ÿπ‘π‘’π‘π‘‘ π‘†π‘‘π‘’π‘›π‘β„Ž, π΅π‘Ÿπ‘’π‘’π‘§π‘’, πΊπ‘™π‘–π‘‘π‘‘π‘’π‘Ÿ, π‘π‘œπ‘›π‘’, π‘π‘œπ‘›π‘’ , 5

Actions: π‘‡π‘’π‘Ÿπ‘›(𝐿𝑒𝑓𝑑), π‘‡π‘’π‘Ÿπ‘›(π‘…π‘–π‘”β„Žπ‘‘), πΉπ‘œπ‘Ÿπ‘€π‘Žπ‘Ÿπ‘‘, π‘†β„Žπ‘œπ‘œπ‘‘, πΊπ‘Ÿπ‘Žπ‘, πΆπ‘™π‘–π‘šπ‘

Perceptions implies facts about current state

βˆ€π‘‘, 𝑠, 𝑔, π‘š, 𝑐 π‘ƒπ‘’π‘Ÿπ‘π‘’π‘π‘‘( 𝑠, π΅π‘Ÿπ‘’π‘’π‘§π‘’, 𝑔, π‘š, 𝑐 , 𝑑) β‡’ π΅π‘Ÿπ‘’π‘’π‘§π‘’(𝑑)

Simple reflex behavior

βˆ€π‘‘ πΊπ‘™π‘–π‘‘π‘‘π‘’π‘Ÿ(𝑑) β‡’ π΅π‘’π‘ π‘‘π΄π‘π‘‘π‘–π‘œπ‘›(πΊπ‘Ÿπ‘Žπ‘, 𝑑)

AskVars(βˆƒπ‘Ž π΅π‘’π‘ π‘‘π΄π‘π‘‘π‘–π‘œπ‘›(π‘Ž, 5))

Binding list: e.g., {π‘Ž/πΊπ‘Ÿπ‘Žπ‘}

18

FOL: Wumpus world example

19

Samples of rules:

βˆ€π‘₯, 𝑦, π‘Ž, 𝑏 𝐴𝑑𝑗 π‘₯, 𝑦 , π‘Ž, 𝑏 ⇔ π‘₯ = π‘Ž ∧ 𝑦 = 𝑏 βˆ’ 1 ∨ 𝑦 = 𝑏 βˆ’ 1

∨ 𝑦 = 𝑏 ∧ π‘₯ = π‘Ž βˆ’ 1 ∨ π‘₯ = π‘Ž + 1

𝐴𝑑 𝐴𝑔𝑒𝑛𝑑, 𝑠, 𝑑

βˆƒπ‘₯, 𝑦 βˆ€π‘‘ 𝐴𝑑(π‘Šπ‘’π‘šπ‘π‘’π‘ , [π‘₯, 𝑦], 𝑑)

βˆ€π‘ , 𝑑 𝐴𝑑 𝐴𝑔𝑒𝑛𝑑, 𝑠, 𝑑 ∧ π΅π‘Ÿπ‘’π‘’π‘§π‘’ 𝑑 β‡’ π΅π‘Ÿπ‘’π‘’π‘§π‘¦ 𝑠

βˆ€π‘₯, 𝑠1, 𝑠2, 𝑑 𝐴𝑑 𝐴𝑔𝑒𝑛𝑑, 𝑠1, 𝑑 ∧ 𝐴𝑑 𝐴𝑔𝑒𝑛𝑑, 𝑠2, 𝑑 β‡’ 𝑠1 = 𝑠2

βˆ€π‘ , 𝑑 π΅π‘Ÿπ‘’π‘’π‘§π‘¦ 𝑠 β‡’ βˆƒπ‘Ÿ 𝐴𝑑𝑗 π‘Ÿ, 𝑠 ∧ 𝑃𝑖𝑑 π‘Ÿ

One successor-state axiom for each predicate

βˆ€π‘‘ π»π‘Žπ‘£π‘’π΄π‘Ÿπ‘Ÿπ‘œπ‘€ 𝑑 + 1 ⇔ ( π»π‘Žπ‘£π‘’π΄π‘Ÿπ‘Ÿπ‘œπ‘€ 𝑑 ∧ Β¬π΄π‘π‘‘π‘–π‘œπ‘› π‘†β„Žπ‘œπ‘œπ‘‘, 𝑑 )

Knowledge Engineering (KE) in FOL

1) Identify the task

2) Assemble the relevant knowledge

3) Decide on a vocabulary of predicates, functions, and

constants (Ontology)

4) Encode general knowledge about the domain

5) Encode a description of the specific problem instance

6) Pose queries to the inference procedure and get answers

7) Debug the knowledge base

20

KE: electronic circuits example

One-bit full adder

XORXOR

ORAND

AND

Carry

21

KE: electronic circuits example (steps)

1) Identify the tasko Does the circuit add properly? (circuit verification)

2) Assemble the relevant knowledgeo Signals, input and output terminals, gates, wires connecting gates,

types of gates (AND,OR, XOR,NOT)

3) Decide on a vocabulary (ontology)o types of gates, terminals of gates, connections between gates, signal

on terminals of gates

o e.g., alternatives for determining the type of a gate:o 𝑇𝑦𝑝𝑒(𝑋1) = 𝑋𝑂𝑅o 𝑋𝑂𝑅(𝑋1)o 𝑇𝑦𝑝𝑒(𝑋1, 𝑋𝑂𝑅)

22

KE: electronic circuits example (steps)

4) Encode general knowledge of the domain

𝑑1, 𝑑2 πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘(𝑑1, 𝑑2) π‘†π‘–π‘”π‘›π‘Žπ‘™(𝑑1) = π‘†π‘–π‘”π‘›π‘Žπ‘™(𝑑2)

𝑑 π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝑑 = 1 ∨ π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝑑 = 0

𝑑1, 𝑑2 πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘ 𝑑1, 𝑑2 ⇔ πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘ 𝑑2, 𝑑1

𝑔 𝑇𝑦𝑝𝑒 𝑔 = 𝑂𝑅 β‡’ (π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝑂𝑒𝑑 1, 𝑔 = 1 ⇔ βˆƒπ‘› π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 𝑛, 𝑔 = 1)

𝑔 𝑇𝑦𝑝𝑒 𝑔 = 𝐴𝑁𝐷 β‡’ (π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝑂𝑒𝑑 1, 𝑔 = 0 ⇔ βˆƒπ‘› π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 𝑛, 𝑔 = 0)

𝑔 𝑇𝑦𝑝𝑒 𝑔 = 𝑋𝑂𝑅 β‡’ (π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝑂𝑒𝑑 1, 𝑔 = 0 ⇔ π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 1, 𝑔

= π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 2, 𝑔 )

𝑔 𝑇𝑦𝑝𝑒 𝑔 = 𝑁𝑂𝑇 (π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝑂𝑒𝑑 1, 𝑔 β‰  π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 1, 𝑔 )

1 β‰  0

23

[You can see a more accurate encoding in 3rd edition of AIMA]

KE: electronic circuits example (steps)

5) Encode the specific problem instance𝑇𝑦𝑝𝑒(𝑋1) = 𝑋𝑂𝑅 𝑇𝑦𝑝𝑒(𝑋2) = 𝑋𝑂𝑅

𝑇𝑦𝑝𝑒(𝐴1) = 𝐴𝑁𝐷 𝑇𝑦𝑝𝑒(𝐴2) = 𝐴𝑁𝐷𝑇𝑦𝑝𝑒(𝑂1) = 𝑂𝑅

πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘ 𝑂𝑒𝑑 1, 𝑋1 , 𝐼𝑛 1, 𝑋2 πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘(𝐼𝑛(1, 𝐢1), 𝐼𝑛(1, 𝑋1))πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘ 𝑂𝑒𝑑 1, 𝑋1 , 𝐼𝑛 2, 𝐴2 πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘(𝐼𝑛(1, 𝐢1), 𝐼𝑛(1, 𝐴1))πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘ 𝑂𝑒𝑑 1, 𝐴2 , 𝐼𝑛 1, 𝑂1 πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘(𝐼𝑛(2, 𝐢1), 𝐼𝑛(2, 𝑋1))πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘ 𝑂𝑒𝑑 1, 𝐴1 , 𝐼𝑛 2, 𝑂1 πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘(𝐼𝑛(2, 𝐢1), 𝐼𝑛(2, 𝐴1))πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘ 𝑂𝑒𝑑 1, 𝑋2 , 𝑂𝑒𝑑 1, 𝐢1 πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘(𝐼𝑛(3, 𝐢1), 𝐼𝑛(2, 𝑋2))πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘ 𝑂𝑒𝑑 1, 𝑂1 , 𝑂𝑒𝑑 2, 𝐢1 πΆπ‘œπ‘›π‘›π‘’π‘π‘‘π‘’π‘‘(𝐼𝑛(3, 𝐢1), 𝐼𝑛(1, 𝐴2))

24

KE: electronic circuits example (steps)

6) Pose queries to the inference procedure

𝑖1, 𝑖2, 𝑖3 π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 1, 𝐢1 = 𝑖1 π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 2, 𝐢1 = 𝑖2

π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 3, 𝐢1 = 𝑖3 π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝑂𝑒𝑑 1, 𝐢1 = 0

π‘†π‘–π‘”π‘›π‘Žπ‘™(𝑂𝑒𝑑(2, 𝐢1)) = 1

Bindings= {𝑖1/1, 𝑖2/1, 𝑖3/0}, {𝑖1/1, 𝑖2/0, 𝑖3/1}, {𝑖1/0, 𝑖2/1, 𝑖3/1}

25

KE: electronic circuits example (steps)

6) Pose queries to the inference procedure

𝑖1, 𝑖2, 𝑖3, π‘œ1, π‘œ2 π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 1, 𝐢1 = 𝑖1 π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 2, 𝐢1 = 𝑖2

π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝐼𝑛 3, 𝐢1 = 𝑖3 π‘†π‘–π‘”π‘›π‘Žπ‘™ 𝑂𝑒𝑑 1, 𝐢1 = π‘œ1

π‘†π‘–π‘”π‘›π‘Žπ‘™(𝑂𝑒𝑑(2, 𝐢1)) = π‘œ2

Bindings = whole input-output table

7) Debug the knowledge base

Has 1 β‰  0 been asserted?

26

Summary

First-order logic:

objects and relations are semantic primitives

syntax: constants, variables, functions, predicates, quantifiers

Knowledge engineering

27


Recommended