Write an evaluator for the language of sums and products

Assignment Help Computer Engineering
Reference no: EM131221033

Labs-

Lab - Create a KB called sjsu that contains the following information:

Turing is the instructor for CS152. Godel, Escher, Bach, and VonNeumann are enrolled in CS152.

Create a rule that defines the relationship Instructor X teaches student Y.

Lab: Recursion

Create and test a knowledge bases for the following scenario.

Homer is the parent of Bart, Lisa, and Maggie. Abe and Mona are Homer's parents.

Marge is also the parent of Bart, Lisa, and Maggie. Clancy and Jacquelin are her parents.

Clancy and Jacquelin are also the parents Selma and Patty.

Parents are ancestors as are ancestors of parents.

Siblings share a parent.

Lab: Arithmetic

We can use structures to represent positive integers in Prolog. For example:

0 = zero

1 = inc(zero)

2 = inc (inc (zero))

3 = inc (inc (inc (zero)))

etc.

Here inc(x) stands for the increment (add one) function.

Define and test the predicate add(X, Y, Z), which represents the relationship Z = X + Y.

Here's a start:

add(zero, X, ???).

add(inc(X), Y, inc(Z)) :- ???.

Define and test the predicate mul(X, Y, Z) which represents the relationship Z = X * Y.

Define and test the predicate exp(X, Y, Z) which represents the relationship Z = X ^ Y.

Define and test the predicate less(X, Y), which represents the relationship X < Y.

Lab: Org Charts, etc.

Define and test the following predicates:

supervises(X, Y) which represents the relationship X supervises Y or a supervisor of Y.

friend(X, Y) which represents the relationship X is a FB friend of Y.

equals(X, Y) which represents the relationship X == Y.

distance(X, Y, Z) which represents the relationship the distance from X to Y is Z hops where X and Y are nodes on an Ethernet wire.

Lab: Evaluating expressions

We can use structures to represent syntax trees in Prolog. For example, the expression

(3 * 4) + (5 + 6)

can be represented by the syntax tree:

sum(prod(num(3), num(4)), sum(num(5), num(6)))

Write an evaluator for the language of sums and products:

?-eval(sum(prod(num(3), num(4)), sum(num(5), num(6))), X).

X = 23.

Lab: Trees

Implement height(Tree, H) where H is the height of a tree of the form leaf or parent(LeftChild, RightChild)

Lab: Proplog

Proplog is a simplified version of Prolog that doesn't allow variables.

Attachment:- Assignment.rar

Reference no: EM131221033

Questions Cloud

Which is not a direct labor cost : Which of the following is not a direct labor cost? Which of the following is an indirect cost?
Banks composition of assets and liabilities : How does your bank's composition of assets and liabilities differ from averages for U.S. commercial banks? What explains these differences?
Determine the ideal number of clusters : Determine the ideal number of clusters. Choose random center points for each cluster. (Note: Each student will select a different random set of centroids.) Using a standard distance formula measure the distance from each data point to each center ..
Research paper on change in human resource development : For the final assignment of this course, you will write a research paper on change in a human resource development (HRD) organization that you work for, or would like to work for.
Write an evaluator for the language of sums and products : We can use structures to represent syntax trees in Prolog. For example, the expression, (3 * 4) + (5 + 6) can be represented by the syntax tree: sum(prod(num(3), num(4)), sum(num(5), num(6))) Write an evaluator for the language of sums and products
Country-el salvador : 1. The relationship over the last 5 years between your country's trade picture and the country's currency exchange rate. 2. The relationship over the last 5 years between your country's Foreign Direct Investment picture and the country's currency e..
Behaviorin extended organization : ApplyingFigure 14.2to what the video tells us about Numi'spolitical behaviorin this extended organization, summarize the role and nature of ethical considerations in this behavior.
Write a matlab script that solve system of linear equations : Write a Matlab script that will solve the system of linear equations shown below. This can be done by solving for the vector of unknowns (X) in the equation AX=B where A is the coefficient matrix and B is the vector on the right-hand side.
Marguerite received nonqualified stock options : Marguerite received nonqualified stock options (NQSOs) with an exercise price equal to the FMV at the date of the grant of $22. Marguerite exercises the options 3 years after the grant date when the FMV of the stock was $30. Marguerite then sells ..

Reviews

Write a Review

Computer Engineering Questions & Answers

  Differences between a requirement and a specification

explain in detail differences between a requirement and a specification. What do they have in common.

  Write hammurabias a well-structured java program

Your task is to write Hammurabias a well-structured Java program using a Scannerobject to handle input - Perform one play-through of the game that results in a successful ten-year rule, and one that results in the people uprising and overthrowing t..

  Developing a shopping cart for a website

Developing a Shopping Cart for a Website - Write a program that explores the seating patterns - Now that you have built a web page for your business, you will be adding a shopping cart allowing users to add and remove items from it.

  Create an entity relationship diagram

Consider a movie rental store that stores movie information, movie rental information, customer information.

  What is mflops rating of the system

What is MFLOPS rating of the system

  Questionwrite down a program visual basic format that has a

questionwrite down a program visual basic format that has a key form with following attributes-a main form with these

  The classic explanation of the marketing mix though

create a detailed with a least 4 bullets in each section of your e-business marketing mix 4 ps product place promotion

  The module review questions listed below these questions

1.answer the module review questions listed below. these questions were chosen to demonstrate your understanding and

  Sources must be cited in apa formatnbsp your response

sources must be cited in apa format.nbsp your response should be a minimum of one single-spaced pagenbspto anbspmaximum

  How big is the minimum value of n0 now

Locate the minimum value of n0 that works and how big is the minimum value of n0 now?

  Different types of data storage processes

Different types of data storage processes.

  Prepare visual basic application

Prepare visual basic application.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd