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

  Write a program to count the number of non-isomorphic

You will write a program to count the number of non-isomorphic simple un-weighted directed graphs with a given number of vertices. The number of vertices will be specified at run time.

  In class we spent a lot of time describing the different

in class we spent a lot of time discussing the different architectures and services that can be used to implement

  Question1 add to situation calculus the ability to paint an

question1. add to situation calculus the ability to paint an object. in particular add the predicate colorobjcolsitthat

  Make a `show me'' button that displays the number

Write down a GUI program that is a game to be played by the user. A new employee is working on a classified mission and the program will randomly pick an expected profit to be guessed by the user. The program must randomly select a number within r..

  Implement a code in lisp to construct lists of random number

Implement a code in LISP to construct lists of random numbers, and lists of consecutive numbers. Show that length is correct for longer lists using the built in function length. Show that the average value of random list entries is as expected.

  Make a heading that contains the name of the software

discuss a specific virus software, its advantages and disadvantages. make a heading that contains the name of the software you are reviewing. It should be about half-page or less.

  Requirements for telecommunications planning

Discuss what do you understand by the general estimate requirements for the enterprise telecommunications planning and also explain in detail the cable estimating procedures.

  What implications does the business model have for systems

Do you agree with Dogster's view, or should companies aim for "zero-defect" operations? Why or why not? What implications does this business model have for systems analysts?

  Build the production software to meet our goal

Our department has been assigned the task of developing new software programs essential to supporting the introduction of Product ABC. We have narrowed our options to 4 possible system design.

  Program that recursive function to print a string backwards

modify a program that uses a recursive function to print a string backwards. Your program must contain a recursive function that prints the string backwards. Do not use any global variables; use appropriate parameters.

  Implementing the program

Write down the program which will enable a teacher to calculate the percentage and the final grade for the students in a class.

  Services commonly supported by a server

explain five services commonly supported by a server and address security mechanisms and devices that are used to support client/server functions.

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