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

First Order Logic

The document provides an overview of First Order Logic (FOL) including: - Why FOL is used to represent knowledge concisely by expressing relationships between objects. - The basic elements of FOL including constants, predicates, functions, variables, and quantifiers. - Examples of FOL expressions representing relationships in domains such as kinship and sets. - How assertions can be added to a knowledge base and queries asked to reason about the knowledge.

Uploaded by

JavaD Alidousti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

First Order Logic

The document provides an overview of First Order Logic (FOL) including: - Why FOL is used to represent knowledge concisely by expressing relationships between objects. - The basic elements of FOL including constants, predicates, functions, variables, and quantifiers. - Examples of FOL expressions representing relationships in domains such as kinship and sets. - How assertions can be added to a knowledge base and queries asked to reason about the knowledge.

Uploaded by

JavaD Alidousti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

First Order Logic (FOL)

CE417: Introduction to Artificial Intelligence


Sharif University of Technology
Spring 2016

Soleymani

“Artificial Intelligence: A Modern Approach”, 3rd Edition, Chapter 8


Why FOL?

 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

2
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 Relation


| variable Object
| Function(Term,…)
1) 𝐵𝑟𝑜𝑡ℎ𝑒𝑟(𝑅𝑖𝑐ℎ𝑎𝑟𝑑, 𝐽𝑜ℎ𝑛)

2) 𝐹𝑎𝑡ℎ𝑒𝑟(𝐽𝑜ℎ𝑛) = 𝐻𝑒𝑛𝑟𝑦
Constant → Richard |A | X1|…
Variable → a | x | s | … 3) 𝑀𝑎𝑟𝑟𝑖𝑒𝑑(𝐹𝑎𝑡ℎ𝑒𝑟(𝑅𝑖𝑐ℎ𝑎𝑟𝑑), 𝑀𝑜𝑡ℎ𝑒𝑟(𝐽𝑜ℎ𝑛))
Function → Mother | LeftLeg |…

Predicate → True | False | After | Loves | Hascolor | ….

7
Syntax of FOL (BNF Grammar)
Sentence → Atomic Sentence | ComplexSentence
Atomic 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 |…
8
𝑂𝑝𝑒𝑟𝑎𝑡𝑜𝑟 𝑃𝑟𝑒𝑐𝑒𝑑𝑒𝑛𝑐𝑒: ¬, =,∧,∨, ⇒, ⟺
Universal quantification

 𝑥 𝑃(𝑥) is true in a model 𝑚 iff 𝑃(𝑥) is true with 𝑥 being


each possible object in the model
 conjunction of instantiations of 𝑃(𝑥)

9
Existential quantification

 𝑥 𝑃(𝑥) is true in a model 𝑚 iff 𝑃(𝑥) is true with 𝑥 being


some 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
 Sample sentences:
 𝑚, 𝑐 𝑀𝑜𝑡ℎ𝑒𝑟 𝑐 = 𝑚 ⇔ (𝐹𝑒𝑚𝑎𝑙𝑒(𝑚) ∧ 𝑃𝑎𝑟𝑒𝑛𝑡(𝑚, 𝑐))
 𝑝, 𝑐 𝑃𝑎𝑟𝑒𝑛𝑡 𝑝, 𝑐 ⇔ 𝐶ℎ𝑖𝑙𝑑(𝑐, 𝑝)
 𝑔, 𝑐 𝐺𝑟𝑎𝑛𝑑𝑝𝑎𝑟𝑒𝑛𝑡 𝑔, 𝑐 ⇔ ∃𝑝 𝑃𝑎𝑟𝑒𝑛𝑡 𝑔, 𝑝 ∧ 𝑃𝑎𝑟𝑒𝑛𝑡 𝑝, 𝑐
 𝑥, 𝑦 𝑆𝑖𝑏𝑖𝑙𝑖𝑛𝑔 𝑥, 𝑦 ⇔ 𝑥 ≠ 𝑦 ∧ ∃𝑝 𝑃𝑎𝑟𝑒𝑛𝑡 𝑝, 𝑥 ∧ 𝑃𝑎𝑟𝑒𝑛𝑡 𝑝, 𝑥

14
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 the
variables to specific values
 AskVars(𝐾𝐵, 𝐾𝑖𝑛𝑔(𝑥)): answer {𝑥/𝐽𝑜ℎ𝑛}
 If KB contains 𝐾𝑖𝑛𝑔 𝐽𝑜ℎ𝑛 ∨ 𝐾𝑖𝑛𝑔(𝑅𝑖𝑐ℎ𝑎𝑟𝑑), there is no binding although
𝐴𝑆𝐾 𝐾𝐵, ∃𝑥 𝐾𝑖𝑛𝑔 𝑥 is true
15
FOL: Set domain example
 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)

16
FOL: Wumpus world example
 Environment
 Objects: pairs identifying squares [𝑖, 𝑗], 𝐴𝑔𝑒𝑛𝑡, 𝑊𝑢𝑚𝑝𝑢𝑠
 Relations: 𝑃𝑖𝑡, 𝐴𝑑𝑗𝑎𝑐𝑒𝑛𝑡, 𝐵𝑟𝑒𝑒𝑧𝑦, 𝑆𝑡𝑒𝑛𝑐ℎ𝑦,
𝑃𝑒𝑟𝑐𝑒𝑝𝑡, 𝐴𝑐𝑡𝑖𝑜𝑛, 𝐴𝑡, 𝐻𝑎𝑣𝑒𝐴𝑟𝑟𝑜𝑤, …

17
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
 Samples of rules:
 ∀𝑥, 𝑦, 𝑎, 𝑏 𝐴𝑑𝑗 𝑥, 𝑦 , 𝑎, 𝑏 ⇔ 𝑥 =𝑎 ∧ 𝑦 =𝑏−1 ∨𝑦 =𝑏−1
∨ 𝑦 =𝑏 ∧ 𝑥 = 𝑎−1 ∨𝑥 =𝑎+1
 𝐴𝑡 𝐴𝑔𝑒𝑛𝑡, 𝑠, 𝑡
 ∃𝑥, 𝑦 ∀𝑡 𝐴𝑡(𝑊𝑢𝑚𝑝𝑢𝑠, [𝑥, 𝑦], 𝑡)
 ∀𝑠, 𝑡 𝐴𝑡 𝐴𝑔𝑒𝑛𝑡, 𝑠, 𝑡 ∧ 𝐵𝑟𝑒𝑒𝑧𝑒 𝑡 ⇒ 𝐵𝑟𝑒𝑒𝑧𝑦 𝑠
 ∀𝑥, 𝑠1 , 𝑠2 , 𝑡 𝐴𝑡 𝐴𝑔𝑒𝑛𝑡, 𝑠1 , 𝑡 ∧ 𝐴𝑡 𝐴𝑔𝑒𝑛𝑡, 𝑠2 , 𝑡 ⇒ 𝑠1 = 𝑠2
 ∀𝑠, 𝑡 𝐵𝑟𝑒𝑒𝑧𝑦 𝑠 ⇒ ∃𝑟 𝐴𝑑𝑗 𝑟, 𝑠 ∧ 𝑃𝑖𝑡 𝑟

 One successor-state axiom for each predicate


 ∀𝑡 𝐻𝑎𝑣𝑒𝐴𝑟𝑟𝑜𝑤 𝑡 + 1 ⇔ ( 𝐻𝑎𝑣𝑒𝐴𝑟𝑟𝑜𝑤 𝑡 ∧ ¬𝐴𝑐𝑡𝑖𝑜𝑛 𝑆ℎ𝑜𝑜𝑡, 𝑡 )

19
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

XOR
XOR

Carry

AND
OR
AND

21
KE: electronic circuits example (steps)
1) Identify the task
o Does the circuit add properly? (circuit verification)

2) Assemble the relevant knowledge


o 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

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


23
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

You might also like