4 Knowledge Representation

Artificial Intelligence · Unit 4 · 14 hrs

Knowledge Representation

Exam-focused notes for Knowledge Representation (Artificial Intelligence, CSC266): what the TU syllabus asks and how it has actually been tested, with 18 solved past questions from this unit.

Knowledge Representation in short

This unit is about representing what an intelligent system knows so that it can be reasoned over mechanically: the general issues any representation scheme must address, the main families of representation in use, propositional and predicate logic in enough formal detail to build and check a resolution proof, and two ways of representing what is not known for certain, probability and fuzzy logic.

Knowledge Representation: notes

Definition and importance of Knowledge

Knowledge is the information about a domain that can be used to solve problems in that domain: not just raw data, but facts, beliefs, relationships and rules that have been organised, categorised and revised over time. Knowledge matters in AI because an agent can only act accurately on an input once it has knowledge or experience relevant to that input; without it, an agent has no basis for choosing one action over another.

Issues in Knowledge Representation

Converting informal knowledge into a form a computer can process is called knowledge representation, and any scheme for doing so must answer several recurring questions: how should the problem be represented; what specific knowledge about the world does solving it actually require; how can an agent acquire that knowledge from experts or from its own experience; what distinctions in the world need to be captured to solve the problem; and how can the resulting knowledge base be debugged, maintained and improved over time.

Knowledge Representation Systems

A knowledge representation system is a formalised structure together with a set of operations for describing objects, relationships and procedures that an AI system can use to solve problems. It has two components: a knowledge base, the stored descriptions themselves, and inference methods, the procedures that manipulate the knowledge base to answer queries and derive new conclusions. A typical system therefore has an end-user interface for queries, an inference engine that applies the representation's inference methods, and a knowledge base holding facts and heuristics, feeding back explanations, conclusions and recommendations to the user.

Properties of Knowledge Representation Systems

A representation scheme is judged on four properties. Representational adequacy is its ability to represent every kind of knowledge the domain actually requires. Inferential adequacy is its ability to manipulate what is represented so as to produce new knowledge from the old. Inferential efficiency is its ability to direct its inference procedures toward the most useful next step rather than searching blindly. Acquisitional efficiency is its ability to acquire new knowledge through automatic methods, rather than depending on a human to add every fact by hand.

Types of Knowledge Representation Systems: Semantic Nets, Frames, Conceptual Dependencies, Scripts, Rule Based Systems, Propositional Logic, Predicate Logic

Semantic networks store knowledge as a labelled graph, with nodes for objects, concepts or situations and labelled arcs (links) for the relationships between them. A semantic network has a physical part (the nodes and links themselves), a structural part (how they form a directed graph), a semantic part (the meaning attached to each label) and a procedural part (operations to construct, destroy and query the network). Several flavours exist: definitional networks, built around an inheritance hierarchy of types and subtypes; assertional networks, which state facts assumed true unless explicitly marked otherwise; implicational networks, which use implication as the main link to represent belief or causality; learning networks, which extend themselves by generalising from examples; and hybrid networks, which combine several of the above. For example, the facts "a cat is a mammal, a cat has fur, a cat likes milk, and Tommy is a cat" are drawn as a mammal node linked to cat by an is-a arc, cat linked to fur by a has arc and to milk by a likes arc, and Tommy linked to cat by an instance-of arc.

Frames represent stereotypical objects or situations (a visual scene, a complex physical object) as a named structure with a set of slots, each slot holding either a value, a pointer to another frame, a default value, a value inherited from a more general frame, or an exception overriding the default. A frame with every slot filled is said to be instantiated; an empty frame is called an object prototype. A book, for example, is naturally a frame with slots for its publisher, title, author, edition, year and page count, each filled with the specific book's data.

Conceptual dependency (CD) theory represents the meaning of a natural-language sentence independently of the specific words used, in terms of a small fixed set of conceptual primitives, so that sentences with the same meaning map to the same CD structure regardless of the language they were expressed in. The primitives include ATRANS (transfer of an abstract relationship, as in "give"), PTRANS (transfer of physical location, as in "go"), PROPEL (applying physical force, as in "push"), MOVE (moving a body part, as in "kick"), GRASP, INGEST, EXPEL, MTRANS (transfer of mental information, as in "tell"), SPEAK and ATTEND. A CD structure combines these primitives with an actor, an object, and case roles such as O (object), R (recipient) and D (destination); "John pushed the bike" becomes John PROPEL bike. The main drawbacks of CD representation are that reconstructing the original sentence from its CD form is difficult, the primitive-to-sentence mapping rules must be crafted carefully for each action, the representation grows large even for simple sentences, and choosing the right primitive in context is not always obvious.

Scripts describe a stereotyped sequence of events, such as going to a restaurant, using components similar to a frame but ordered: entry conditions that must hold before the script's events can occur, results that will hold afterwards, props (the objects involved), roles (the people involved), tracks (variations on the general pattern that share some but not all of the script's components), and scenes (the ordered sequence of events itself).

Rule-based systems represent knowledge as a set of condition-action pairs, or production rules, of the form IF <premise> THEN <action>, such as "if it is raining then open the umbrella" or "if Caesar is a man then Caesar is a person"; because the rules and the reasoning engine are kept separate, new rules can be added without touching the inference procedure. A rule-based system has three parts: a working memory holding only the facts currently relevant, a rule base organised for efficient matching against the working memory, and an interpreter that repeatedly selects and fires a matching rule. A small example sorts the string cbacar (built from the letters $a, b, c$) using the rules $ba \to ab$, $ca \to ac$ and $cb \to bc$, applying whichever matching rule the interpreter's strategy selects at each iteration until no rule applies and the string is sorted.

Propositional logic and predicate logic represent knowledge as logically well-formed sentences that can be manipulated by formal rules of inference; because they carry exact, checkable semantics, they are treated in full detail in the next two sections.

What this unit covers

  • Definition and importance of Knowledge
  • Issues in Knowledge Representation
  • Knowledge Representation Systems
  • Properties of Knowledge Representation Systems
  • Types of Knowledge Representation Systems: Semantic Nets, Frames, Conceptual Dependencies, Scripts, Rule Based Systems, Propositional Logic, Predicate Logic
  • Propositional Logic(PL): Syntax, Semantics, Formal logic-connectives, truth tables, tautology, validity, well-formed-formula, Inference using Resolution, Backward Chaining and Forward Chaining
  • Predicate Logic: FOPL, Syntax, Semantics, Quantification, Inference with FOPL: By converting into PL (Existential and universal instantiation), Unification and lifting, Inference using resolution
  • Handling Uncertain Knowledge, Radom Variables, Prior and Posterior Probability, Inference using Full Joint Distribution, Bayes' Rule and its use, Bayesian Networks, Reasoning in Belief Networks
  • Fuzzy Logic

Predicate Logic

2081 · 10 marks

What is Skolem constant? How is Skolemization done during resolution? Represent the following statements into FOPL. - All movies are not hit. - Sarangi is a movie. - All movies which have good script are hit. - Sarangi has a good script but Sarangi is sentimental. - There is a movie which is comedy.[10]

Show solved answer

Skolem Constant, Skolemization, and FOPL Representation

1. Skolem Constant

A Skolem constant is a special constant introduced during the process of Skolemization to eliminate existential quantifiers from a First Order Predicate Logic (FOPL) formula. When an existential quantifier appears in a formula without any enclosing universal quantifier, the existentially quantified variable is replaced by a unique new constant (called a Skolem constant) that represents the specific (but unnamed) individual whose existence is asserted.

Example:

  • Formula: ∃x P(x)
  • After Skolemization: P(a) where a is a Skolem constant.

If the existential quantifier is within the scope of a universal quantifier, the existential variable is replaced by a Skolem function (not a constant) of the universally quantified variables.

Example:

  • Formula: ∀x ∃y Loves(x, y)
  • After Skolemization: ∀x Loves(x, f(x)) where f(x) is a Skolem function.

2. Skolemization During Resolution

Skolemization is the process of removing existential quantifiers from a FOPL formula to prepare it for resolution. Resolution works on clausal form (CNF), and existential quantifiers must be eliminated before conversion to clause form.

Steps of Skolemization (as part of full conversion to clause form):

StepOperation
1Eliminate implications and biconditionals
2Move negations inward (using De Morgan's laws)
3Standardize variables apart
4Move quantifiers to the left (Prenex Normal Form)
5Skolemize: eliminate existential quantifiers
6Drop universal quantifiers
7Convert to Conjunctive Normal Form (CNF)
8Write as a set of clauses

Rules of Skolemization:

  • Case 1: If ∃x appears outside the scope of any universal quantifier, replace x with a Skolem constant (e.g., a, b, c).

    ∃x Movie(x) becomes Movie(SK1) where SK1 is a Skolem constant.

  • Case 2: If ∃x appears within the scope of universal quantifiers ∀y1, ∀y2, ..., replace x with a Skolem function of those variables.

    ∀x ∃y HasScript(x, y) becomes ∀x HasScript(x, f(x)) where f(x) is a Skolem function.


3. Representation of Statements into FOPL

Predicates Used:

  • Movie(x) : x is a movie
  • Hit(x) : x is a hit
  • GoodScript(x) : x has a good script
  • Sentimental(x) : x is sentimental
  • Comedy(x) : x is a comedy

Statement 1: "All movies are not hit."

Every x, if x is a movie, then x is not a hit.

$$\forall x ; Movie(x) \Rightarrow \neg Hit(x)$$


Statement 2: "Sarangi is a movie."

Sarangi is a specific individual (constant).

$$Movie(Sarangi)$$


Statement 3: "All movies which have good script are hit."

Every x, if x is a movie AND x has a good script, then x is a hit.

$$\forall x ; [Movie(x) \wedge GoodScript(x)] \Rightarrow Hit(x)$$


Statement 4: "Sarangi has a good script but Sarangi is sentimental."

Conjunction of two facts about the constant Sarangi.

$$GoodScript(Sarangi) \wedge Sentimental(Sarangi)$$


Statement 5: "There is a movie which is comedy."

There exists some x such that x is a movie and x is a comedy.

$$\exists x ; [Movie(x) \wedge Comedy(x)]$$

After Skolemization (since ∃x has no enclosing universal quantifier, replace x with Skolem constant SK1):

$$Movie(SK1) \wedge Comedy(SK1)$$


Summary Table

StatementFOPL Representation
All movies are not hit∀x Movie(x) ⇒ ¬Hit(x)
Sarangi is a movieMovie(Sarangi)
All movies with good script are hit∀x [Movie(x) ∧ GoodScript(x)] ⇒ Hit(x)
Sarangi has good script but is sentimentalGoodScript(Sarangi) ∧ Sentimental(Sarangi)
There is a movie which is comedy∃x [Movie(x) ∧ Comedy(x)]

Note: Statements 1 and 3 appear contradictory (all movies are not hit vs. movies with good script are hit). This is intentional in the problem, likely to test resolution-based contradiction detection. In resolution, we would derive a contradiction from Movie(Sarangi), GoodScript(Sarangi), Statement 1, and Statement 3.

Open this answer on its own page →

2080 · 10 marks

Write the rules to convert statements in predicate logic into CNF form. Convert the following sentences into FOPL. All students of BSC CSIT are intelligent person. All friends of intelligent person are smart. Laxmi is a friend of Rojina. Rojina is smart. All beautiful students are girl. Laxmi is beautiful. Using resolution algorithm infer that 'Laxmi is smart'.[10]

Show solved answer

Converting Statements to CNF and Resolution in FOPL

Part 1: Rules to Convert FOPL into CNF

  1. Eliminate implications and biconditionals: replace $P \to Q$ with $\neg P \lor Q$, and $P \leftrightarrow Q$ with $(\neg P \lor Q) \land (\neg Q \lor P)$.
  2. Move negation inward (De Morgan / quantifier duals):
    • $\neg(P \lor Q) \equiv \neg P \land \neg Q$
    • $\neg(P \land Q) \equiv \neg P \lor \neg Q$
    • $\neg \forall x,P(x) \equiv \exists x,\neg P(x)$
    • $\neg \exists x,P(x) \equiv \forall x,\neg P(x)$
    • $\neg\neg P \equiv P$
  3. Standardize variables apart: rename so each quantifier binds a unique variable.
  4. Move quantifiers to front (prenex form).
  5. Skolemize: replace existential variables with Skolem constants (no enclosing $\forall$) or Skolem functions of the enclosing universal variables.
  6. Drop universal quantifiers (remaining variables are implicitly universal).
  7. Distribute $\lor$ over $\land$: $P \lor (Q \land R) \equiv (P \lor Q) \land (P \lor R)$.
  8. Write as a set of clauses (each conjunct is a clause), renaming variables apart across clauses.

Part 2: FOPL Representation

Predicates:

  • $CSIT(x)$: $x$ is a student of BSc CSIT
  • $Intel(x)$: $x$ is an intelligent person
  • $Friend(x,y)$: $x$ is a friend of $y$
  • $Smart(x)$: $x$ is smart
  • $Beautiful(x)$: $x$ is beautiful
  • $Girl(x)$: $x$ is a girl
SentenceFOPL
All students of BSc CSIT are intelligent$\forall x,(CSIT(x) \to Intel(x))$
All friends of an intelligent person are smart$\forall x,\forall y,((Intel(y) \land Friend(x,y)) \to Smart(x))$
Laxmi is a friend of Rojina$Friend(Laxmi, Rojina)$
Rojina is smart$Smart(Rojina)$
All beautiful students are girls$\forall x,((Beautiful(x) \land CSIT(x)) \to Girl(x))$
Laxmi is beautiful$Beautiful(Laxmi)$

Important data note. The conclusion "Laxmi is smart" uses the rule "all friends of an intelligent person are smart" plus "Laxmi is a friend of Rojina." So we need $Rojina$ to be an intelligent person. This requires $Rojina$ to be a BSc CSIT student, i.e. $CSIT(Rojina)$. This fact is NOT stated in the question. The listed facts ($Smart(Rojina)$, $Beautiful(Laxmi)$, "beautiful students are girls") do not lead to $Smart(Laxmi)$. As written, the proof is not derivable.

To make the intended chain work, the standard exam assumption is that Rojina is a BSc CSIT student ($CSIT(Rojina)$). I proceed with that assumption stated explicitly; without it, the inference fails.


Part 3: Convert to CNF (Clause Form)

  • C1: $\neg CSIT(x) \lor Intel(x)$ (from sentence 1)
  • C2: $\neg Intel(y) \lor \neg Friend(x,y) \lor Smart(x)$ (from sentence 2)
  • C3: $Friend(Laxmi, Rojina)$
  • C4: $Smart(Rojina)$
  • C5: $\neg Beautiful(z) \lor \neg CSIT(z) \lor Girl(z)$ (from sentence 5)
  • C6: $Beautiful(Laxmi)$
  • C7 (assumed): $CSIT(Rojina)$

Part 4: Resolution to Infer "Laxmi is Smart"

Negated goal (C8): $\neg Smart(Laxmi)$

Step 1. Resolve C2 with C8, unifier ${x/Laxmi}$: $$\neg Intel(y) \lor \neg Friend(Laxmi, y) \lor Smart(Laxmi) ;\text{ and }; \neg Smart(Laxmi)$$ $$\Rightarrow \textbf{C9: } \neg Intel(y) \lor \neg Friend(Laxmi, y)$$

Step 2. Resolve C9 with C3 $Friend(Laxmi, Rojina)$, unifier ${y/Rojina}$: $$\Rightarrow \textbf{C10: } \neg Intel(Rojina)$$

Step 3. Resolve C10 with C1 $\neg CSIT(x) \lor Intel(x)$, unifier ${x/Rojina}$: $$\Rightarrow \textbf{C11: } \neg CSIT(Rojina)$$

Step 4. Resolve C11 with C7 $CSIT(Rojina)$: $$\Rightarrow \textbf{C12: } \square ;\text{(empty clause)}$$

Since we derived the empty clause (contradiction), the negated goal is false, so the original goal holds: $$\boxed{Smart(Laxmi) \text{ is TRUE}}$$

Caveat: This proof depends on the added premise $CSIT(Rojina)$. With only the six sentences exactly as given (no $CSIT(Rojina)$), the empty clause cannot be derived and "Laxmi is smart" is not provable. The clauses C5, C6 (beauty/girl) are irrelevant to this conclusion.

Open this answer on its own page →

2079 · 5 marks

Convert Following Sentences into Predicate: a) All animal who can bark are dog. b) Someone is firing a gun c) All tigers are not fierce [5]

In First Order Predicate Logic (FOPL), each sentence is broken down into predicates representing relationships between subjects. We use: - Universal Quantifier: ∀x (for all x) - Existential Quantifier: ∃x (there exists some x) - Implication: ⇒ - Negation: ¬ - Conjunction: ∧ --- Analysis: - "All a...

Open this answer on its own page →

2079 · 5 marks

Writes short note of the following(any TWO): a. Pragmatic Analysis b. Unification and lifting c. Turing test [5]

--- Pragmatic Analysis is one of the phases of Natural Language Processing (NLP). It deals with using and understanding sentences in different situations and examines how the interpretation of a sentence is affected by the context in which it is used. - The main focus of pragmatic analysis is on ...

Open this answer on its own page →

2078 · 10 marks

Consider following facts: Every traffic chases driver. Every driver who horns is smart. No traffic catches any smart driver. Any traffic who chases some driver but does not catch him frusted. Now configure FoPL knowledge base for above statements. Use resolution algorithm to draw a conclusion that “If all drivers horn, then all traffics are frusted.”[10]

Show solved answer

Resolution Algorithm: Proving "If All Drivers Horn, Then All Traffics Are Frustrated"

Step 1: Identify the Facts and Convert to FoPL (First Order Predicate Logic)

Let us define the predicates:

  • Traffic(x) : x is a traffic
  • Driver(x) : x is a driver
  • Horns(x) : x horns
  • Smart(x) : x is smart
  • Chases(x, y) : x chases y
  • Catches(x, y) : x catches y
  • Frustrated(x) : x is frustrated

FoPL Knowledge Base

#Natural Language StatementFoPL Formula
F1Every traffic chases (every) driver∀x ∀y [Traffic(x) ∧ Driver(y) → Chases(x, y)]
F2Every driver who horns is smart∀x [Driver(x) ∧ Horns(x) → Smart(x)]
F3No traffic catches any smart driver∀x ∀y [Traffic(x) ∧ Smart(y) → ¬Catches(x, y)]
F4Any traffic who chases some driver but does not catch him is frustrated∀x ∀y [Traffic(x) ∧ Driver(y) ∧ Chases(x,y) ∧ ¬Catches(x,y) → Frustrated(x)]

Goal (to prove):

If all drivers horn, then all traffics are frustrated. ∀x ∀y [Driver(y) ∧ Horns(y) ∧ Traffic(x) → Frustrated(x)]


Step 2: Convert All Statements to Conjunctive Normal Form (CNF) / Clause Form

Using the implication elimination rule: A → B ≡ ¬A ∨ B

C1 (from F1):

∀x ∀y [Traffic(x) ∧ Driver(y) → Chases(x, y)]
≡ ¬Traffic(x) ∨ ¬Driver(y) ∨ Chases(x, y)

C2 (from F2):

∀x [Driver(x) ∧ Horns(x) → Smart(x)]
≡ ¬Driver(x) ∨ ¬Horns(x) ∨ Smart(x)

C3 (from F3):

∀x ∀y [Traffic(x) ∧ Smart(y) → ¬Catches(x, y)]
≡ ¬Traffic(x) ∨ ¬Smart(y) ∨ ¬Catches(x, y)

C4 (from F4):

∀x ∀y [Traffic(x) ∧ Driver(y) ∧ Chases(x,y) ∧ ¬Catches(x,y) → Frustrated(x)]
≡ ¬Traffic(x) ∨ ¬Driver(y) ∨ ¬Chases(x,y) ∨ Catches(x,y) ∨ Frustrated(x)

Step 3: Negate the Goal (for Proof by Refutation / Resolution)

The goal to prove:

∀x ∀y [Traffic(x) ∧ Driver(y) ∧ Horns(y) → Frustrated(x)]

Negate the goal:

¬[∀x ∀y (Traffic(x) ∧ Driver(y) ∧ Horns(y) → Frustrated(x))]
≡ ∃x ∃y [Traffic(x) ∧ Driver(y) ∧ Horns(y) ∧ ¬Frustrated(x)]

Using Skolemization (replace existential variables with constants a and b):

C5: Traffic(a)

C6: Driver(b)

C7: Horns(b)

C8: ¬Frustrated(a)


Step 4: Apply Resolution Algorithm

We now have the clause set:

C1: ¬Traffic(x) ∨ ¬Driver(y) ∨ Chases(x, y)
C2: ¬Driver(x) ∨ ¬Horns(x) ∨ Smart(x)
C3: ¬Traffic(x) ∨ ¬Smart(y) ∨ ¬Catches(x, y)
C4: ¬Traffic(x) ∨ ¬Driver(y) ∨ ¬Chases(x,y) ∨ Catches(x,y) ∨ Frustrated(x)
C5: Traffic(a)
C6: Driver(b)
C7: Horns(b)
C8: ¬Frustrated(a)

Resolution Steps:

Step R1: Resolve C2 with C6 and C7

C2 : ¬Driver(x) ∨ ¬Horns(x) ∨ Smart(x)   [x = b]
C6 : Driver(b)
C7 : Horns(b)
----------------------------------------------
R1 : Smart(b)

Step R2: Resolve C1 with C5 and C6

C1 : ¬Traffic(x) ∨ ¬Driver(y) ∨ Chases(x, y)   [x = a, y = b]
C5 : Traffic(a)
C6 : Driver(b)
----------------------------------------------
R2 : Chases(a, b)

Step R3: Resolve C3 with C5 and R1

C3 : ¬Traffic(x) ∨ ¬Smart(y) ∨ ¬Catches(x, y)   [x = a, y = b]
C5 : Traffic(a)
R1 : Smart(b)
----------------------------------------------
R3 : ¬Catches(a, b)

Step R4: Resolve C4 with C5, C6, and R2

C4 : ¬Traffic(x) ∨ ¬Driver(y) ∨ ¬Chases(x,y) ∨ Catches(x,y) ∨ Frustrated(x)   [x = a, y = b]
C5 : Traffic(a)
C6 : Driver(b)
R2 : Chases(a, b)
----------------------------------------------
R4 : Catches(a, b) ∨ Frustrated(a)

Step R5: Resolve R4 with R3

R4 : Catches(a, b) ∨ Frustrated(a)
R3 : ¬Catches(a, b)
----------------------------------------------
R5 : Frustrated(a)

Step R6: Resolve R5 with C8

R5 : Frustrated(a)
C8 : ¬Frustrated(a)
----------------------------------------------
NIL  (Empty Clause -- Contradiction!)

Step 5: Conclusion

Since resolution derives the empty clause (NIL) from the knowledge base together with the negated goal, the negated goal is unsatisfiable together with the facts. By the refutation principle, this proves the original statement:

$$\boxed{\text{If all drivers horn, then all traffics are frustrated.}}$$

Open this answer on its own page →

2076 · 10 marks

How resolution algorithm is used in FOPL to infer conclusion? Consider the facts; Anyone whom Pugu loves is a star. Any hero who does not rehearse does not act. Anmol is a hero. Any hero who does not work does not rehearse. Anyone who does not act is not a star. Convert above into FOPL and use resolution to infer that “If Anmol does not work, then Pugu does not love Anmol”.[10]

Resolution is a refutation-based inference method used in First Order Predicate Logic (FOPL). The steps are: 1. Convert all facts (Knowledge Base) into Conjunctive Normal Form (CNF) 2. Negate the conclusion to be proved 3. Repeatedly apply the resolution rule (resolve pairs of clauses that contai...

Open this answer on its own page →

2080.1 · 10 marks

What do you mean by unification and lifting? Convert following sentences into FOPL: Sushma likes all kinds of practical courses. AI and DBMS are practical courses. Any subject anyone practices is practical course. Ruby practices PHP. Rita practices everything that Ruby practices. Using resolution check whether 'Sushma likes PHP' is inferred or not.[10]

Show solved answer

Unification, Lifting, and Resolution in FOPL

Part 1: Unification and Lifting

Unification

Unification is the process of finding a substitution (a unifier) that makes two or more logical expressions identical.

  • A substitution $\theta$ is a set of bindings ${x/term, \dots}$.
  • Applying $\theta$ to an expression $P$ gives $\text{SUBST}(\theta, P)$.
  • $\theta$ unifies $P$ and $Q$ if $\text{SUBST}(\theta, P) = \text{SUBST}(\theta, Q)$.
  • The Most General Unifier (MGU) is the least restrictive such substitution.

Example: $P = Knows(John, x)$, $Q = Knows(John, Jane)$. MGU $\theta = {x/Jane}$, giving $Knows(John, Jane)$.

Lifting

Lifting raises a propositional inference rule to the first-order level using variables and unification. In propositional logic Modus Ponens works only on ground facts; Generalized (Lifted) Modus Ponens extends it to FOPL.

For $P_1', \dots, P_n'$ and $(P_1 \wedge \dots \wedge P_n \Rightarrow Q)$, if there is $\theta$ with $\text{SUBST}(\theta, P_i') = \text{SUBST}(\theta, P_i)$, then conclude $\text{SUBST}(\theta, Q)$.

Example: $King(John)$, $Greedy(y)$ with $King(x)\wedge Greedy(x)\Rightarrow Evil(x)$, $\theta={x/John, y/John}$ gives $Evil(John)$.


Part 2: Converting Sentences to FOPL

Predicates:

  • $Likes(x,y)$: x likes y
  • $Practical(x)$: x is a practical course
  • $Practices(x,y)$: x practices y
No.EnglishFOPL
1Sushma likes all kinds of practical courses$\forall x,[Practical(x) \Rightarrow Likes(Sushma, x)]$
2AI and DBMS are practical courses$Practical(AI) \wedge Practical(DBMS)$
3Any subject anyone practices is a practical course$\forall x,\forall y,[Practices(x,y) \Rightarrow Practical(y)]$
4Ruby practices PHP$Practices(Ruby, PHP)$
5Rita practices everything Ruby practices$\forall x,[Practices(Ruby, x) \Rightarrow Practices(Rita, x)]$

Part 3: Resolution to Prove "Sushma likes PHP"

Step 1: Clause Form (CNF)

ClauseClause Form
$C_1$$\neg Practical(x) \vee Likes(Sushma, x)$
$C_2$$Practical(AI)$
$C_3$$Practical(DBMS)$
$C_4$$\neg Practices(u, v) \vee Practical(v)$
$C_5$$Practices(Ruby, PHP)$
$C_6$$\neg Practices(Ruby, w) \vee Practices(Rita, w)$

Step 2: Negate the Goal

Goal: $Likes(Sushma, PHP)$. Negated goal: $$C_7: \neg Likes(Sushma, PHP)$$

Step 3: Apply Resolution

Resolve $C_1$ and $C_7$, $\theta = {x/PHP}$: $$C_8: \neg Practical(PHP)$$

Resolve $C_4$ and $C_5$, $\theta = {u/Ruby,; v/PHP}$: $$C_9: Practical(PHP)$$

Resolve $C_8$ and $C_9$: $$\square \quad (\text{empty clause, contradiction})$$

Resolution Proof Tree

C1: ¬Practical(x) ∨ Likes(Sushma,x)      C7: ¬Likes(Sushma,PHP)
                    \  {x/PHP}            /
                     C8: ¬Practical(PHP)

C4: ¬Practices(u,v) ∨ Practical(v)       C5: Practices(Ruby,PHP)
                    \  {u/Ruby, v/PHP}   /
                     C9: Practical(PHP)

           C8: ¬Practical(PHP)   C9: Practical(PHP)
                        \        /
                         [ NIL ]  ← contradiction

Conclusion

Since resolution derives the empty clause $\square$, the negated goal is unsatisfiable with the KB. Therefore "Sushma likes PHP" is inferred (proved TRUE).

(Note: clauses $C_6$, and facts about $AI$/$DBMS$, are not needed for this particular proof, since PHP is shown to be practical directly from Ruby practicing it.)

Open this answer on its own page →

Types of Knowledge Representation Systems

2081 · 5 marks

How can you represent knowledge using scripts? Create a knowlege base using script based on your own assumption. [5]

A script is a structured knowledge representation technique used in AI to represent stereotyped sequences of events in a particular context. It was introduced by Roger Schank and Robert Abelson (1977). A script describes a typical sequence of events that occur in a well-known, predictable situati...

Open this answer on its own page →

2080 · 5 marks

How knowledge is represented using frames? Represent following knowledge using frames. Ram is name of an employee. His age is 27. He is male. He belongs to the department HR, where the number of employees is 110 and the average salary of the department is Rs. 45000. All departments are under Tribhuvan University. The organization type of Tribhuvan University is Educational. [5]

A frame is a data structure used to represent stereotyped situations or objects. Each frame consists of: - Frame Name: The name of the object or concept being represented - Slots: Attributes or properties of the object - Fillers: Values assigned to those slots Frames support inheritance, meaning ...

Open this answer on its own page →

2078 · 5 marks

Construct semantic network for following facts: Ram is person. Persons are humans. All human have nose. Humans are instances of mammals. Ram has weight of 60 kg. Weight of Ram is less than weight of Sita. [5]

A semantic network represents knowledge as a graph where: - Nodes represent objects, concepts, or classes - Arcs (links) represent relationships between them - Common relationships: is-a (subclass), instance-of (element of class), and property links --- 1. Ram is a person. 2. Persons are humans. ...

Open this answer on its own page →

2076 · 5 marks

Define frame. How knowledge is encoded in a frame? Justify with an example. [5]

A frame is a data structure used to represent stereotyped situations or objects in Artificial Intelligence. It is a collection of slots (attributes) and slot values (fillers) that together describe an entity, concept, or situation. Frames organize related knowledge about a particular object or ev...

Open this answer on its own page →

2080.1 · 5 marks

What is semantic network? Given following knowledge base, represent it using semantic network. Subash is a student. All students are person. Person has hair. Ram is a player. All player play game. Game is a physical action. Height of all players is larger than the height of all student. Physical action starts from 7:00 AM and ends at 9:00 AM. [5]

A semantic network (or semantic net) is a knowledge representation technique that stores knowledge in the form of a graph, where: - Nodes represent objects, concepts, or situations (physical or abstract) - Arcs (links) represent the relationships between those nodes It is simple, easy to implemen...

Open this answer on its own page →

Fuzzy Logic

2081 · 5 marks

Define fuzzy logic. Construct a fuzzy rule base expert system with your own considerations of fuzzy set. [5]

Fuzzy logic is a form of multi-valued logic derived from fuzzy set theory that deals with approximate reasoning rather than precise (crisp) reasoning. Unlike classical binary logic where variables take only values of 0 (false) or 1 (true), fuzzy logic allows variables to take any value between 0 ...

Open this answer on its own page →

2079 · 5 marks

What is fuzzy logic? Discuss the different operators used in genetic algorithm. [5]

--- Fuzzy Logic is a form of multi-valued logic that deals with approximate reasoning rather than fixed and exact reasoning. Unlike classical (Boolean) logic where variables take only two values (0 or 1, True or False), fuzzy logic allows variables to take any value between 0 and 1, representing ...

Open this answer on its own page →

2076 · 5 marks

What do you mean by membership of an element in a fuzzy set? Given a domain of discourse X={10, 20, 30, 40, 50, 60, 70}, construct a fuzzy set from X. Use your own assumptions for defining membership. [5]

The membership of an element in a fuzzy set refers to the degree to which an element belongs to a fuzzy set. Unlike classical (crisp) sets where membership is either 0 or 1, in a fuzzy set, each element is assigned a grade of membership in the range [0, 1]. Mathematically, if A is a fuzzy set ove...

Open this answer on its own page →

Propositional Logic

2079 · 5 marks

What is forward chaining? Explain with appropriate example. [5]

Forward chaining is a data-driven inference technique used in rule-based systems and knowledge bases. It starts from the known facts (data) and applies inference rules in a forward direction to derive new facts, continuing this process until the goal is reached or no more new facts can be derived...

Open this answer on its own page →

Handling Uncertain Knowledge, Radom Variables, Prior and Posterior Probability, Inference using Full Joint Distribution, Bayes' Rule and its use, Bayesian Networks, Reasoning in Belief Networks

2078 · 5 marks

What is prosteroir probability? Consider a scenario that a patient have liver disease is 15% probability. A test says that 5% of patients are alcholic. Among those patients diagnosed with liver disease, 7% are alcoholic. Now computer the chance of having liver disease, if the patient is alcoholic. [5]

Symbol Meaning Value ------------------------ $P(L)$ Probability a patient has liver disease $0.15$ $P(A)$ Probability a patient is alcoholic $0.05$ $P(A\mid L)$ Probability a patient is alcoholic given they have liver disease $0.07$ Required: $P(L\mid A)$ - the probability of having liver diseas...

Open this answer on its own page →

2076 · 5 marks

How uncertain knowledge is represented? Given following full joint probability distribution representing probabilities of having different sizes of CD, find the probability that a CD cover has a length of 130mm given the width is 15mm.

$$\begin{array}{|c|c|c|c|c|}\hline \text{y=Width} & \text{x=Length} & 129 & 130 & 131 \ \hline 15 & & 0.12 & 0.42 & 0.06 \ 16 & & 0.08 & 0.28 & 0.04 \ \hline \end{array}$$

[5]

Full joint probability distribution: y = Width x = 129 x = 130 x = 131 -------------------------------------- 15 0.12 0.42 0.06 16 0.08 0.28 0.04 Check total: $0.12+0.42+0.06+0.08+0.28+0.04 = 1.00$ ✓ Required: $P(\text{Length}=130 \mid \text{Width}=15)$ --- Real-world AI agents rarely have comple...

Open this answer on its own page →