SlideShare a Scribd company logo
Knowledge Representation
 using First-Order Logic
Domain
• Domain is a section of the knowledge
  representation.
     - The Kinship domain
     - Mathematical sets
     - Assertions and queries in first order logic
     - The Wumpus World
Kinship domain
Kinship domain(family relationship)
It consists of
• Object – People
• Unary Predicates - Male and Female
• Binary Predicates - Parent,Brother,Sister
• Functions – Father, Mother
• Relations – Brotherhood, sisterhood.
Examples
The kinship domain:
• Brothers are siblings
  ∀x,y Brother(x,y) => Sibling(x,y)


• Male and female are disjoint categories
  ∀x, Male(x) ⇔ ¬Female(x)


• Parent and child are inverse relations
  ∀p,c Parent(p,c) ⇔ Child(c,p)
Mathematical sets
Mathematical set representation
• Constant – Empty set (s = {})
• Predicate – Member and subset (s1 ⊆ s2)
• Functions – Intersection( ∩ ) and union (∪ )

•   Example: Two sets are equal if and only if each is a subset of the
    other.
 ∀s1,s2 (s1=s2) ⇔(subset(s1,s2) ∧ subset(s2,s1))
Other eg:
 ∀x,s1,s2 x ∈ (s1 ∩ s2) ⇔ (x ∈ s1 ∧ x ∈ s2)
 ∀x,s1,s2 x ∈ (s1 ∪ s2) ⇔ (x ∈ s1 ∨ x ∈ s2)
Assertions and Queries in
     first-order logic
Assertions
• Sentences are added to a knowledge base
  using TELL are called assertions.
• We want to TELL things to the KB,
   e.g. TELL(KB, King(John))
        TELL(KB, ∀ x king(x) => Person(x))
        John is a king and that king is a person.
Queries
• Questions are asked to the knowledge base
  using ASK called as queries or goals.
• We also want to ASK things to the KB,
  ASK(KB, ∃x , Person (x ) )

      returns true by substituting john to a x.
Wumpus world
Agent Architectures
• Reflex agents: Classify their percept and act
  accordingly.
• Model based agents: Construct an internal
  representation of the world and use it to act.
• Goal based agent : Form goals and try to
  achieve them.
FOL Version of Wumpus World
• Typical percept sentence:
  Percept([Stench,Breeze,Glitter,None,None],3)

• In this sentence:
  Percept - predicate
  Stench, Breeze and glitter – Constants
  3 – Integer to represent time

• Actions:
  Turn Right), Turn Left), Forward, Shoot, Grab, Release,
  Climb
Cont..,
• To determine best action, construct query:
  ∀ a BestAction(a,5)

• ASK solves this query and returns {a/Grab}
   – Agent program then calls TELL to record the action
     which was taken to update the KB.
• Percept sequences
    1. Synchronic sentences (same time).
           - sentences dealing with time.
    2. Diachronic sentences (across time).
            - agent needs to know how to
  combine information about its previous
  location to current location.
Two kinds of synchronic rules
  1.Diagnostic rules
  2.Casual rules
Deducing hidden properties
• Squares are breezy near a pit:
  – Diagnostic rule---infer cause from effect
     ∀s Breezy(s) ⇔ ∃ r Adjacent(r,s) ∧ Pit(r)


  – Causal rule---infer effect from cause
  ∀r Pit(r) ⇒ [∀s Adjacent(r,s) ⇒ Breezy(s)]
Knowledge engineering in
         FOL
Steps
1. Identify the task

3. Assemble the relevant knowledge

5. Decide on a vocabulary of predicates, functions, and
   constants

7. Encode general knowledge about the domain

9. Encode a description of the specific problem instance

11. Pose queries to the inference procedure and get
    answers

13. Debug the knowledge base
The electronic circuits domain
One-bit full adder




Possible queries:
  - does the circuit function properly?
  - what gates are connected to the first input terminal?
  - what would happen if one of the gates is broken?
  and so on
The electronic circuits domain
1. Identify the task
   – Does the circuit actually add properly?

2. Assemble the relevant knowledge
   – Composed of wires and gates; Types of gates (AND,
     OR, XOR, NOT)
   – Two input terminals and one output terminal
3. Decide on a vocabulary

•     Alternatives:
     Type(X1) = XOR (function)
     Type(X1, XOR) (binary predicate)
     XOR(X1) (unary predicate)

        It can be represented by either
    binary predicate or individual type.
4. Encode general knowledge of the
             domain
 1.If two terminals are connected, then they have
the same signal.

 ∀t1,t2 Connected(t1, t2) ⇒ Signal(t1) = Signal(t2)

2.The signal at every terminal is either 1 or 0
  (but not both)

 ∀t Signal(t) = 1 ∨ Signal(t) = 0

  1≠0
3. Connected is a commutative predicate.

  ∀t1,t2 Connected(t1, t2) ⇒ Connected(t2, t1)




4. An OR gate’s output is 1 if and only if any of its input is 1.

   ∀g Type(g) = OR ⇒
   Signal(Out(1,g)) = 1 ⇔ ∃n Signal(In(n,g)) = 1
5. An AND gate’s output is 0 if and only if any of its
  input is 0.
   ∀g Type(g) = AND ⇒
   Signal(Out(1,g)) = 0 ⇔ ∃n Signal(In(n,g)) = 0

6. An XOR gate’s output is 1 if and only if any of its
  inputs are different:
   ∀g Type(g) = XOR ⇒Signal(Out(1,g)) = 1 ⇔
     Signal(In(1,g)) ≠ Signal(In(2,g))
7. An XOR gate’s output is 1 if and only if any of its
  inputs are different:
      ∀g Type(g) = NOT ⇒
   Signal(Out(1,g)) ≠ Signal(In(1,g))
5. Encode the specific problem
                instance
• First we categorize the gates:



  Type(X1) = XOR             Type(X2) = XOR
  Type(A1) = AND             Type(A2) = AND
  Type(O1) = OR

  – Then show the connections between them:
Connected(Out(1,X1),In(1,X2))
 Connected(In(1,C1),In(1,X1))
Connected(Out(1,X1),In(2,A2))
 Connected(In(1,C1),In(1,A1))
Connected(Out(1,A2),In(1,O1))
 Connected(In(2,C1),In(2,X1))
Connected(Out(1,A1),In(2,O1))
 Connected(In(2,C1),In(2,A1))
Connected(Out(1,X2),Out(1,C1))
 Connected(In(3,C1),In(2,X2))
Connected(Out(1,O1),Out(2,C1))
 Connected(In(3,C1),In(1,A2))
6. Pose queries to the inference
   procedure and get answers


     For the given query the inference
procedure operate on the problem
specific facts and derive the answers.
What are the possible sets of values of all the
 terminals for the adder circuit?

∃i1,i2,i3,o1,o2 Signal(In(1,C1)) =
        i1 ∧ Signal(In(2,C1)) = i2 ∧ Signal(In(3,C1)) = i3 ∧
Signal(Out(1,C1)) = o1 ∧ Signal(Out(2,C1)) = o2
7. Debug the knowledge base

• For the given query, if the result is not a
  user expected one then KB is updated
  with relevant axioms.
• The KB is checked with different
  constraints.eg:prove any output for the
  circuit i.e.,0 or 1.

More Related Content

PPTX
Problem solving agents
PPTX
State space search and Problem Solving techniques
PPTX
Knowledge representation
PPTX
Certinity Factor and Dempster-shafer theory .pptx
PPTX
Control Strategies in AI
PPTX
Artificial Intelligence Searching Techniques
PDF
Ai lecture 7(unit02)
PPTX
Problem Formulation
Problem solving agents
State space search and Problem Solving techniques
Knowledge representation
Certinity Factor and Dempster-shafer theory .pptx
Control Strategies in AI
Artificial Intelligence Searching Techniques
Ai lecture 7(unit02)
Problem Formulation

What's hot (20)

PDF
Ai lecture 06(unit-02)
PPTX
Lecture 21 problem reduction search ao star search
PPTX
Mid point circle algorithm
PPTX
Artificial Intelligence- TicTacToe game
PPTX
Kr using rules
PPTX
Water jug problem ai part 6
PPTX
Inference in First-Order Logic
PPT
Artificial Intelligence: Case-based & Model-based Reasoning
PPT
3 problem-solving-
PPTX
ProLog (Artificial Intelligence) Introduction
PPTX
Problem reduction AND OR GRAPH & AO* algorithm.ppt
PPT
Knowledge Representation & Reasoning
PPTX
Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)
PPT
Planning
PPTX
State space search
PPTX
Tsp is NP-Complete
PPTX
Knowledge representation and Predicate logic
PPTX
Problem solving in Artificial Intelligence.pptx
PPTX
Logics for non monotonic reasoning-ai
PDF
AI_unit IV Full Notes.pdf
Ai lecture 06(unit-02)
Lecture 21 problem reduction search ao star search
Mid point circle algorithm
Artificial Intelligence- TicTacToe game
Kr using rules
Water jug problem ai part 6
Inference in First-Order Logic
Artificial Intelligence: Case-based & Model-based Reasoning
3 problem-solving-
ProLog (Artificial Intelligence) Introduction
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Knowledge Representation & Reasoning
Weak Slot and Filler Structure (by Mintoo Jakhmola LPU)
Planning
State space search
Tsp is NP-Complete
Knowledge representation and Predicate logic
Problem solving in Artificial Intelligence.pptx
Logics for non monotonic reasoning-ai
AI_unit IV Full Notes.pdf
Ad

Viewers also liked (14)

PPT
Ch2 3-informed (heuristic) search
PPT
Jarrar.lecture notes.aai.2011s.ch7.p logic
PPT
Class first order logic
PPT
Introduction iii
PPT
Lecture 11 Informed Search
PPT
Logic agent
PPTX
Lecture 14 Heuristic Search-A star algorithm
PPTX
Artificial intelligence- Logic Agents
PPT
Solving problems by searching
PPTX
Informed and Uninformed search Strategies
PPT
Solving problems by searching Informed (heuristics) Search
PPT
Heuristic Search Techniques {Artificial Intelligence}
DOC
مقدمة في الشبكات العصبية الاصطناعية
Ch2 3-informed (heuristic) search
Jarrar.lecture notes.aai.2011s.ch7.p logic
Class first order logic
Introduction iii
Lecture 11 Informed Search
Logic agent
Lecture 14 Heuristic Search-A star algorithm
Artificial intelligence- Logic Agents
Solving problems by searching
Informed and Uninformed search Strategies
Solving problems by searching Informed (heuristics) Search
Heuristic Search Techniques {Artificial Intelligence}
مقدمة في الشبكات العصبية الاصطناعية
Ad

Similar to Knowledge engg using & in fol (20)

PPT
Frstorder 9 sldes read
PDF
Dynamic Programming From CS 6515(Fibonacci, LIS, LCS))
PPT
KNOWLEDGE Representation unit 3 for data mining
PPTX
Topology Matters in Communication
PDF
09 - 27 Jan - Recursion Part 1
PPTX
Digital electronics basic overview .pptx
PDF
An overview of Hidden Markov Models (HMM)
PDF
Understanding Reed-Solomon code
PPT
PDF
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
PPTX
Teknik Simulasi
PPT
lecture07 dicrete mathematics relation .ppt
PPTX
Abductive commonsense reasoning
PPT
Stacksqueueslists
PPT
Stacks queues lists
PPT
Stacks queues lists
PPT
Stacks queues lists
PPT
Stack squeues lists
PPT
Stacks queues lists
Frstorder 9 sldes read
Dynamic Programming From CS 6515(Fibonacci, LIS, LCS))
KNOWLEDGE Representation unit 3 for data mining
Topology Matters in Communication
09 - 27 Jan - Recursion Part 1
Digital electronics basic overview .pptx
An overview of Hidden Markov Models (HMM)
Understanding Reed-Solomon code
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
Teknik Simulasi
lecture07 dicrete mathematics relation .ppt
Abductive commonsense reasoning
Stacksqueueslists
Stacks queues lists
Stacks queues lists
Stacks queues lists
Stack squeues lists
Stacks queues lists

Recently uploaded (20)

PPTX
Pharma ospi slides which help in ospi learning
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Cell Types and Its function , kingdom of life
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Insiders guide to clinical Medicine.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Institutional Correction lecture only . . .
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Classroom Observation Tools for Teachers
PDF
Complications of Minimal Access Surgery at WLH
Pharma ospi slides which help in ospi learning
FourierSeries-QuestionsWithAnswers(Part-A).pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Anesthesia in Laparoscopic Surgery in India
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Cell Types and Its function , kingdom of life
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Insiders guide to clinical Medicine.pdf
Sports Quiz easy sports quiz sports quiz
STATICS OF THE RIGID BODIES Hibbelers.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Institutional Correction lecture only . . .
Pharmacology of Heart Failure /Pharmacotherapy of CHF
O5-L3 Freight Transport Ops (International) V1.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Classroom Observation Tools for Teachers
Complications of Minimal Access Surgery at WLH

Knowledge engg using & in fol

  • 1. Knowledge Representation using First-Order Logic
  • 2. Domain • Domain is a section of the knowledge representation. - The Kinship domain - Mathematical sets - Assertions and queries in first order logic - The Wumpus World
  • 4. Kinship domain(family relationship) It consists of • Object – People • Unary Predicates - Male and Female • Binary Predicates - Parent,Brother,Sister • Functions – Father, Mother • Relations – Brotherhood, sisterhood.
  • 5. Examples The kinship domain: • Brothers are siblings ∀x,y Brother(x,y) => Sibling(x,y) • Male and female are disjoint categories ∀x, Male(x) ⇔ ¬Female(x) • Parent and child are inverse relations ∀p,c Parent(p,c) ⇔ Child(c,p)
  • 7. Mathematical set representation • Constant – Empty set (s = {}) • Predicate – Member and subset (s1 ⊆ s2) • Functions – Intersection( ∩ ) and union (∪ ) • Example: Two sets are equal if and only if each is a subset of the other. ∀s1,s2 (s1=s2) ⇔(subset(s1,s2) ∧ subset(s2,s1)) Other eg: ∀x,s1,s2 x ∈ (s1 ∩ s2) ⇔ (x ∈ s1 ∧ x ∈ s2) ∀x,s1,s2 x ∈ (s1 ∪ s2) ⇔ (x ∈ s1 ∨ x ∈ s2)
  • 8. Assertions and Queries in first-order logic
  • 9. Assertions • Sentences are added to a knowledge base using TELL are called assertions. • We want to TELL things to the KB, e.g. TELL(KB, King(John)) TELL(KB, ∀ x king(x) => Person(x)) John is a king and that king is a person.
  • 10. Queries • Questions are asked to the knowledge base using ASK called as queries or goals. • We also want to ASK things to the KB, ASK(KB, ∃x , Person (x ) ) returns true by substituting john to a x.
  • 12. Agent Architectures • Reflex agents: Classify their percept and act accordingly. • Model based agents: Construct an internal representation of the world and use it to act. • Goal based agent : Form goals and try to achieve them.
  • 13. FOL Version of Wumpus World • Typical percept sentence: Percept([Stench,Breeze,Glitter,None,None],3) • In this sentence: Percept - predicate Stench, Breeze and glitter – Constants 3 – Integer to represent time • Actions: Turn Right), Turn Left), Forward, Shoot, Grab, Release, Climb
  • 14. Cont.., • To determine best action, construct query: ∀ a BestAction(a,5) • ASK solves this query and returns {a/Grab} – Agent program then calls TELL to record the action which was taken to update the KB.
  • 15. • Percept sequences 1. Synchronic sentences (same time). - sentences dealing with time. 2. Diachronic sentences (across time). - agent needs to know how to combine information about its previous location to current location.
  • 16. Two kinds of synchronic rules 1.Diagnostic rules 2.Casual rules
  • 17. Deducing hidden properties • Squares are breezy near a pit: – Diagnostic rule---infer cause from effect ∀s Breezy(s) ⇔ ∃ r Adjacent(r,s) ∧ Pit(r) – Causal rule---infer effect from cause ∀r Pit(r) ⇒ [∀s Adjacent(r,s) ⇒ Breezy(s)]
  • 19. Steps 1. Identify the task 3. Assemble the relevant knowledge 5. Decide on a vocabulary of predicates, functions, and constants 7. Encode general knowledge about the domain 9. Encode a description of the specific problem instance 11. Pose queries to the inference procedure and get answers 13. Debug the knowledge base
  • 20. The electronic circuits domain One-bit full adder Possible queries: - does the circuit function properly? - what gates are connected to the first input terminal? - what would happen if one of the gates is broken? and so on
  • 21. The electronic circuits domain 1. Identify the task – Does the circuit actually add properly? 2. Assemble the relevant knowledge – Composed of wires and gates; Types of gates (AND, OR, XOR, NOT) – Two input terminals and one output terminal
  • 22. 3. Decide on a vocabulary • Alternatives: Type(X1) = XOR (function) Type(X1, XOR) (binary predicate) XOR(X1) (unary predicate) It can be represented by either binary predicate or individual type.
  • 23. 4. Encode general knowledge of the domain 1.If two terminals are connected, then they have the same signal. ∀t1,t2 Connected(t1, t2) ⇒ Signal(t1) = Signal(t2) 2.The signal at every terminal is either 1 or 0 (but not both) ∀t Signal(t) = 1 ∨ Signal(t) = 0 1≠0
  • 24. 3. Connected is a commutative predicate. ∀t1,t2 Connected(t1, t2) ⇒ Connected(t2, t1) 4. An OR gate’s output is 1 if and only if any of its input is 1. ∀g Type(g) = OR ⇒ Signal(Out(1,g)) = 1 ⇔ ∃n Signal(In(n,g)) = 1
  • 25. 5. An AND gate’s output is 0 if and only if any of its input is 0. ∀g Type(g) = AND ⇒ Signal(Out(1,g)) = 0 ⇔ ∃n Signal(In(n,g)) = 0 6. An XOR gate’s output is 1 if and only if any of its inputs are different: ∀g Type(g) = XOR ⇒Signal(Out(1,g)) = 1 ⇔ Signal(In(1,g)) ≠ Signal(In(2,g))
  • 26. 7. An XOR gate’s output is 1 if and only if any of its inputs are different: ∀g Type(g) = NOT ⇒ Signal(Out(1,g)) ≠ Signal(In(1,g))
  • 27. 5. Encode the specific problem instance • First we categorize the gates: Type(X1) = XOR Type(X2) = XOR Type(A1) = AND Type(A2) = AND Type(O1) = OR – Then show the connections between them:
  • 28. Connected(Out(1,X1),In(1,X2)) Connected(In(1,C1),In(1,X1)) Connected(Out(1,X1),In(2,A2)) Connected(In(1,C1),In(1,A1)) Connected(Out(1,A2),In(1,O1)) Connected(In(2,C1),In(2,X1)) Connected(Out(1,A1),In(2,O1)) Connected(In(2,C1),In(2,A1)) Connected(Out(1,X2),Out(1,C1)) Connected(In(3,C1),In(2,X2)) Connected(Out(1,O1),Out(2,C1)) Connected(In(3,C1),In(1,A2))
  • 29. 6. Pose queries to the inference procedure and get answers For the given query the inference procedure operate on the problem specific facts and derive the answers.
  • 30. What are the possible sets of values of all the terminals for the adder circuit? ∃i1,i2,i3,o1,o2 Signal(In(1,C1)) = i1 ∧ Signal(In(2,C1)) = i2 ∧ Signal(In(3,C1)) = i3 ∧ Signal(Out(1,C1)) = o1 ∧ Signal(Out(2,C1)) = o2
  • 31. 7. Debug the knowledge base • For the given query, if the result is not a user expected one then KB is updated with relevant axioms. • The KB is checked with different constraints.eg:prove any output for the circuit i.e.,0 or 1.