Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective:This lab activity aims to demonstrate how to use the logpy or Kanren library for logicprogramming in Python.Lab Activity No . 1 :Write a Python

Objective:This lab activity aims to demonstrate how to use the logpy or Kanren library for logicprogramming in Python.Lab Activity No.1:Write a Python program that uses logic programming to recommend a dish to a person. Therecommendation is made based on:o if someone likes a dish of a certain type that has a certain flavor, so mostprobably they would like other dishes with the same flavor.o Facts about food types and flavorsRelationsWe need to initiate the following relations to construct the facts about food types, foodflavors, and a set of persons favorite food:o Food Typeo Food Flavoro LikesFacts:The following statements declare facts about some foods and some persons favorite foods:Food Types:o Gouda is cheeseo Ritz is crackero Steak is meato Sausage is meato Lemonade is juiceo Cookie is dessert2 EMAI-611: Programming for AIFlavors:o Dessert is sweeto Meat is savoryo Cheese is savoryo Cracker is savoryo Juice is sweetLikes:o Noor likes sausageo Melissa likes Ritzo Dmitry likes cookieo Nikita likes sausageo Assel likes limonadeSolution Instructions:You should write your information (Name, ID, Section)# EMAI-611: Advanced Programming for AI# Lecture 1 Lab Activity#Date:#Name:#KAU ID:#Section:Step 1: Define the three relations using Relation ()Step 2: Construct all the listed facts for each relation defined in Step 1 using the factStep 3: Define a method, food_flavor(x, y)that takes two parameters the first parameter forflavor and the second for food type, and should return all the foods with the same flavor.Step 4: Define a method, dish_to_like(person, what)that takes two parameters a person's name and a parameter for what food the person likesand returns what other options of food are recommended for that person.Note: dish_to_like method will calls food_flavor methodYou need to define all variables using var() and you need conde, run, and llalmethods

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

=+What kind of question would you ask to encourage their response?

Answered: 1 week ago

Question

8. Provide recommendations for how to manage knowledge.

Answered: 1 week ago

Question

5. Develop a self-management module for a training program.

Answered: 1 week ago