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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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