This is an optional homework. You are under no obligation to do it. The grade on this homework will take the place of a lower homework score (if any).
You should use the following algebraic data types for expressions and statements:
datatype expr = LIT of int
| PLUS of expr * expr
| TIMES of expr * expr
| VAR of string
;
datatype stmt = SKIP
| ASSIGN of string * expr
| SEQ of stmt * stmt
| PRINT of expr
| IFPOS of expr * stmt * stmt
| UNTILPOS of expr * stmt
;
type memory = string -> int;
type output = int list;
You should name the denotational functions
and
sExpr and sStmt respectively.
they should have type:
sExpr : expr -> memory -> int sStmt : stmt -> memory -> memory * outputPut your solution in
homework14.sml.
Give the weakest precondition at the beginning of this code that
enables us to prove that
at the end of the following code:
y = x; if (y < 0) y = 0 - y; else skipShow your work! Simplify the final logical expression.
Put your answer in a PLAIN ASCII TEXT file named homework14.txt.
You submit your program work by putting it in the homework14 directory
in your AFS class volume.
The homework14 directory should include the following: