0% found this document useful (0 votes)
45 views11 pages

Ai Exercise

The document discusses representing relationships between animals using a semantic network. It also discusses representing books using frames and controlling smart home devices using propositional logic statements.

Uploaded by

Meshack
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views11 pages

Ai Exercise

The document discusses representing relationships between animals using a semantic network. It also discusses representing books using frames and controlling smart home devices using propositional logic statements.

Uploaded by

Meshack
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

KCA UNIVERSITY

User
[COMPANY NAME] [Company address]
NAME: OTIENO JAVIS

SCHOOL ID: 22/03328

UNIT NAME: PRINSIPLES OF ARTIFFICIAL INTELLIGENCE

UNIT CODE: BSD 2207

TASK: EXERCISE
1. Semantic Networks:
o Scenario: A zookeeper is managing various animals in a wildlife sanctuary. Each
animal has specific characteristics and dietary preferences.
o Question: Represent the relationships between animals, their characteristics
(e.g., habitat, diet, size), and any interactions (e.g., predator-prey relationships)
using a semantic network.
Predicates:

• Student(name): This predicate is true if "name" is a student in the system.


• Major(student, major): This predicate is true if "student" is a major in "major".
• Enrolled(student, course): This predicate is true if "student" is enrolled in the course
"course".
• Wants(student, course): This predicate is true if "student" wants to take the course
"course".

Logical Expressions:

1. “John is an engineering major.”

This can be expressed as:

• Major(John, "Engineering")

2. “Mary wants to take both Calculus and Physics.”

This can be expressed in two ways depending on the desired meaning:

• Wants(Mary, "Calculus") ∧ Wants(Mary, "Physics") (This means Mary wants to take


Calculus and Physics independently)
• ∀course (Wants(Mary, course) → (course = "Calculus" ∨ course =
"Physics")) (This means Mary only wants courses that are either Calculus or Physics)

Here's a breakdown of the second expression:

• ∀course: This quantifies over all possible courses.


• (Wants(Mary, course) → (course = "Calculus" ∨ course = "Physics")): This states
that for any course Mary wants to take (Wants(Mary, course)), the course must be
either Calculus or Physics.
2.Frames:

o Scenario: An online bookstore wants to organize information about books. Each


book has attributes such as title, author, genre, publication year, and price.
o Question: Create a frame for representing a book, including slots for each attribute.
Populate the frame with details of a specific book.
3.Propositional Logic:

o Scenario: A smart home system controls various devices (lights, thermostat,


security cameras). Each device has specific conditions for activation.
o Question: Write a set of propositional logic statements that describe when the
lights should turn on (e.g., “If it’s dark outside and someone enters the room, turn on
the lights.”).

Propositions:

• D: It is dark outside.
• M: Motion is detected in the room.
• L: Lights are on.

Logic Statements:

1. D ∨ M → L: (If it's dark outside OR someone enters the room, then turn on the lights.)
This captures the basic scenario where lights can be activated by either darkness or
motion.
2. (D ∧ ¬M) → L: (If it's dark outside AND no motion is detected, then turn on the lights
after a certain time.) This adds a layer of nuance, where lights only turn on at night if no
movement is detected for a period (to avoid unnecessary activation during sleep). You
can replace "certain time" with a specific time proposition (T) if desired.
3. L ∧ ¬(D ∨ M) → ¬L: (If the lights are on AND it's not dark outside and no motion is
detected, then turn off the lights.) This ensures lights are turned off when not needed.
Predicates and Logical Expressions:
Here's how we can define predicates and create logical expressions for the university
course registration system:

Predicates:

• Student(name): This predicate is true if "name" is a student in the system.


• Major(student, major): This predicate is true if "student" is a major in "major".
• Enrolled(student, course): This predicate is true if "student" is enrolled in the course
"course".
• Wants(student, course): This predicate is true if "student" wants to take the course
"course".

Logical Expressions:

1. “John is an engineering major.”

This can be expressed as:

• Major(John, "Engineering")

2. “Mary wants to take both Calculus and Physics.”

This can be expressed in two ways depending on the desired meaning:

• Wants(Mary, "Calculus") ∧ Wants(Mary, "Physics") (This means Mary wants to take


Calculus and Physics independently)
• ∀course (Wants(Mary, course) → (course = "Calculus" ∨ course =
"Physics")) (This means Mary only wants courses that are either Calculus or Physics)

Here's a breakdown of the second expression:


• ∀course: This quantifies over all possible courses.
• (Wants(Mary, course) → (course = "Calculus" ∨ course = "Physics")): This states
that for any course Mary wants to take (Wants(Mary, course)), the course must be
either Calculus or Physics.

You might also like