Two students have complained that there is more homework towards the end of the class, so I will allow you to hand in the last two sets up to 7 days late if you wish.

Homework for the rest of the quarter is now online, but is subject to change in case problems are out of sync with the readings.

Homework will be due on Thursdays for the rest of the quarter, to better synchronize with the lectures, after the delay induced by the midterm.

Binary for OBJ3 is at

Standard ML of New Jersey, version 110.0.6 is available on all CSE unix
machines at
`/net/cs/class/development/elkan/cse230/sml-110/bin/sml`

, which you
can either define as an alias for `sml`

, or else you can add the
path for its directory to the `PATH`

variable of your environment.
You should actually run your ML code for all of the ML programming problems,
and turn in your code along with its output.

Binary for BinProlog 4.00 for Solaris machines (such as the CSE
instructional machines beowulf, bintijua, kongo, or the machines in the APE
lab) can be found at **/net/cs/class/wi99/cse230/prolog/bp**, and also as a
backup, at **/net/cat/disk1/prolog/bp**; the latter directory also contains
some other files, including some relevant to exercises, so that you don't have
to do all the typing yourself. Some basic notes on using BinProlog 4.00 are
at **binpro.html**.

- Please hand in homework in paper hardcopy form; do not email me or the TAs an attachment! Computer printed paper is much preferred; if your handwriting is too hard to read, you will lose credit. You may also lose points if your solution is too difficult to understand, whether due to English or technical problems.
- Please give the assignment set number and problem number for each question; also be sure to include your name, and the due date. If there are multiple pages, you should staple them; since there are 60 students, loose pages are likely to be lost, and you will not get credit.
- For problems that require use of a computer, always hand in both your input and your output as part of your solution.
- Assignments will normally be posted by Monday, due on Tuesday of the following week. Homework due more than 5 days away is subject to change.
- Our TA is a volunteer, and it is highly unreasonable to expect her to grade 50 homework sets each week! Every problem you hand in will be checked, but only a random subset (chosen to be maximally helpful to you, subject to our resource limitations) will be graded; you will get up to 3 points for a problem that is handed in and checked, and up to 10 points for one that is graded; of course, the total for homework will be weighted appropriately when combined with the midterm and final.
- Be sure to
**reload**this page frequently, because sometimes it may be updated frequently (but this may be unnecessary because I have put some meta tags onto pages).

- Due 15 January:
- Say where Java would go in the Figure on p.23 of Stansifer; write a short paragraph of about 30 words justifying your choice. (You can just photocopy the figure and add a line and dot for Java in red ink.)
- Briefly compare Java with at least three other languages from among those
described in Chapter 1 of Stansifer (FORTRAN, COBOL, BASIC, Algol, C, Lisp,
ML, Ada, C++, etc.); the languages that you choose for comparison should be
very different from each other; write one paragraph for each comparison;
please try to hit the main points and avoid the trivial points.
**Note:**If you are unfamiliar with Java, you should be able to learn enough to answer the above questions in about 30 minutes, by going to the campus bookstore (or nearly any other bookstore in the country) and skimming parts of one or more of the many Java books there. - Say what is your own favorite programming language, and explain why you
like it, without falling into merely subjective considerations; i.e., you
should base your argument on real historical, cultural, and pragmatic
considerations, as described in the
*Preliminary Essay on Comparative Programming Linguistics*.

- Due 22 January:
- Write a regular expression that will cause grep to search for, and print the instances of, all the Ada identifiers (as defined on p.45 of Stansifer) that occur as lines in an input file; test it on the file grep.data.html. You may use any convenient variant of grep, such as egrep; you can type "man grep" or "man egrep" etc. at any Sun workstation to learn what you need to know. Be sure to hand in your output file, plus of course your regular expression.
- Exercise 2.3 of Stansifer (p.69).
- Write the grammar for regular expressions on p.48 of Stansifer as an OBJ3
signature, and run at least 10 test cases, of diverse character, for it using
the OBJ3 "parse" command (see p.19 of
**Algebraic Semantics**); be sure to hand in your output, and of course the code. (Note: you will have to fudge the use of parentheses somehow, for example, by replacing them with [ and ].) - Exercises 2.8 and 2.9 of Stansifer (p.70).

- Due 29 January:
- Exercise 2.13 of Stansifer (p.71).
- Exercise 2.20 of Stansifer (p.73). [Due to a possible ambiguity in this problem, if you failed to give an explanation of why your less than 10 word answer is correct, you may hand in such an explanation on Thursday, 7 February.]
- Let Sigma be the signature of the OBJ module NATEXP given on page 19 of
**Algebraic Semantics**, with the following added:

ops x y z : -> Exp .

Let A be the Sigma algebra with carrier the set of natural numbers, with x,y,z interpreted as 1,2,3 (resp.), and with 0,s,+,* interpreted in the usual way. Then every Sigma term gets a unique interpretation in A, according to the map phi-bar defined on page 21. Calculate the value under phi-bar of the following terms:- s(x + y) + z ;
- (x * y) + s s 0 ;
- (s s 0 * x) + s(y * z) .

- Due 5 February: No homework is due this week; please study for the
midterm. The following questions, as well as some of those assigned for next
week, might help you with this.
- Give an OBJ syntax for each of the assignment statements on page 78 of Stansifer, and for each of the "updating assignment statements" on page 80; give some OBJ3 input and output showing that your signatures work.
- If Sigma is the signature of the module
`NATEXPEQ`

on page 39 of**Algebraic Semantics**, give two Sigma-algebras where the first equation (0 + X = X) does not hold. - Exercise 3.5 of Stansifer (p.101).
- Exercise 3.8 of Stansifer (p.102).

- Due 12 February:
- Exercise 1, pp.43-46 of
**Algebraic Semantics**; be sure hand in your input and output. - Exercise 4.8 of Stansifer (p.138).
- Exercise 4.11 of Stansifer (p.138).
- Exercise 4, p.64 of
**Algebraic Semantics**. - Exercise 6, p.64 of
**Algebraic Semantics**.

- Exercise 1, pp.43-46 of
- Due 21 February:
- Exercises 2.1.4, 2.3.2 and 2.4.3 of Ullman (pp. 20, 33, 43).
- Exercise 9, p.65 of
**Algebraic Semantics**using OBJ. - Exercise 12, pp.76-77 of
**Algebraic Semantics**using OBJ. - Exercise 15, p.78 of
**Algebraic Semantics**using OBJ. - Exercise 5.6 of Stansifer (p.179-180).
- Exercise 5.8 of Stansifer (p.180-181).

- Due 28 February:
- Exercises 3.1.2, 3.2.4, 3.3.3, 3.3.10 of Ullman (pp. 53, 65, 75, 76).
- Exercise 17, p.88 of
**Algebraic Semantics**using OBJ. - Exercise 20, p.89 of
**Algebraic Semantics**using OBJ. - Exercise 22, pp.105-106 of
**Algebraic Semantics**using OBJ. - Exercises 3.4.4, 3.4.7, 3.5.2 of Ullman (pp. 83, 83, 88).
**Note:**there is a typo in problem 3.4.4: instead of "3.2.1(e)", it should say "3.2.1(f)"; also, in 3.2.1(f), "list of reals" should be changed to "list of strings". - Exercises 3.6.1 and 3.6.3 of Ullman (p. 98).

- Due 7 March:
- Exercise 6.1 of Stansifer (p.208); use of Prolog is optional, but include your output if you do use it; in each case be sure to say how many answers there are.
- Exercise 6.4 of Stansifer (p.209) using Prolog.
- Exercise 6.5 of Stansifer (p.210) using Prolog. (Dana Dahlstrom points out that "dangerous" is an adjective, not an adverb.)
- Exercise 6.21 of Stansifer (p.213) using Prolog.
- Exercise 6.17 of Stansifer (p.212), using the OBJ3 spec for unification; explain what this code does, roughly how it does it, and comment on the results of running the cases in Stansifer; use OBJ3 and include your output.
- Exercises 5.1.4, 5.2.1, 5.3.1b,c,e,g,h, 5.4.2, and 5.4.4 of Ullman (pp. 132, 141, 154, 166, 167).

**Note:**If you prefer another Prolog system over BinProlog, you may use it instead.

- Due 14 March:
- Exercise 6.9 of Stansifer (p.211) using Prolog.
- Prove partial correctness of the little program on p.312 of Stansifer using OBJ3 and the approach of algebraic denotational semantics; in particular, be sure to treat the variables correctly (as opposed to the treatment in Stansifer).
- Exercises 7.2 and 7.3 of Stansifer (p.260).
- Exercise 7.17 of Stansifer (p.262)
- Exercise 7.20 of Stansifer (p.263) using OBJ (for some helpful hints see
Section C.6, p.72 of
**Introducing OBJ**), or alternatively, see Lambda calculus in OBJ; please have**trace**turned on for this problem. (You don't need to hand in all of the output, just the first and last few rewrites would be enough. Also there is an inconsistency in the definition of`S`

, but you can check page 228 of Stansifer, or Lambda calculus in OBJ for the right definition.) - Exercises 5.5.7b, 5.6.1d,f of Ullman (pp. 173, 183).
- Exercises 6.2.3 and 6.3.1 of Ullman (pp. 206, 222).

To CSE 230 homepage

Maintained by Joseph Goguen

© 2000, 2001, 2002 Joseph Goguen

Last modified: Thu Mar 7 17:45:59 PST 2002