Docsity

CS 477 Homework #5: Solving Exercises and Proving Theorems in Maude - Prof. Jose Meseguer, Assignments of Computer Science

Toggle sidebar
bg1
CS 477 Homework #5 Due 4:45pm on 10/21
Note: Answers to the exercises listed below should be handed to the instructor in hardcopy and in typewritten
form (latex formatting preferred) by the deadline mentioned above. You should also email to ([email protected])
the Maude code for the exercises requiring that.
1. Solve Ex. 10.3 in Lecture 10.
2. Solve Ex. 3.2 in Lecture 3
Note: You should use noetherian induction to solve this exercise. In this regard, notice that a full answer to
Ex. 3.1 is already contained in the treatment by Winskel. What I call “noetherian induction,” is what he calls
“well-founded induction,” because a noetherian relation is also called a well-founded relation. Notice that in
Winskel’s treatment the relation itself need not be a partial order (but will then generate a partial order by
transitive closure that is also well-founded).
3. Consider the following module, which was already used in Homework 4, of lists with an append constructor
function that is associative and has an identity, but where associativity and identity are explicitly defined by
equations:
(fmod LIST is
sort List .
ops a b c nil : -> List [ctor] .
op append : List List -> List [ctor] .
vars L P Q : List .
eq append(append(L, P), Q) = append(L, append(P, Q)) .
eq append(L, nil) = L .
eq append(nil, L) = L .
endfm)
In Homework 4 you were asked to use the Maude Church-Rosser Checker to establish the local confluence of
this module (which with termination implies confluence). But can you do it yourself? That is: you are asked
to:
•compute all the critical pairs of this module, give a complete list of them, and explain what computations
you have performed to arrive at that list; and
•show that each critical pair can be joined; you can use Maude for this purpose, for example using the ==
operator to compute that for each critical pair (t, t′) both terms hace the same canonical form.
4. Consider the module
fmod LIST-of-NAT is protecting NAT .
sort List .
subsort Nat < List .
op nil : -> List [ctor] .
op _;_ : List List -> List [ctor assoc] .
op length : List -> Nat .
var N : Nat .
var L : List .
eq nil ; L = L .
eq L ; nil = L .
1
pf2

Partial preview of the text

Download CS 477 Homework #5: Solving Exercises and Proving Theorems in Maude - Prof. Jose Meseguer and more Assignments Computer Science in PDF only on Docsity!

CS 477 Homework #5 Due 4:45pm on 10/

Note: Answers to the exercises listed below should be handed to the instructor in hardcopy and in typewritten form (latex formatting preferred) by the deadline mentioned above. You should also email to ([email protected]) the Maude code for the exercises requiring that.

  1. Solve Ex. 10.3 in Lecture 10.
  2. Solve Ex. 3.2 in Lecture 3 Note: You should use noetherian induction to solve this exercise. In this regard, notice that a full answer to Ex. 3.1 is already contained in the treatment by Winskel. What I call “noetherian induction,” is what he calls “well-founded induction,” because a noetherian relation is also called a well-founded relation. Notice that in Winskel’s treatment the relation itself need not be a partial order (but will then generate a partial order by transitive closure that is also well-founded).
  3. Consider the following module, which was already used in Homework 4, of lists with an append constructor function that is associative and has an identity, but where associativity and identity are explicitly defined by equations:

(fmod LIST is sort List. ops a b c nil : -> List [ctor]. op append : List List -> List [ctor]. vars L P Q : List. eq append(append(L, P), Q) = append(L, append(P, Q)). eq append(L, nil) = L. eq append(nil, L) = L. endfm)

In Homework 4 you were asked to use the Maude Church-Rosser Checker to establish the local confluence of this module (which with termination implies confluence). But can you do it yourself? That is: you are asked to:

  • compute all the critical pairs of this module, give a complete list of them, and explain what computations you have performed to arrive at that list; and
  • show that each critical pair can be joined; you can use Maude for this purpose, for example using the == operator to compute that for each critical pair (t, t′) both terms hace the same canonical form.
  1. Consider the module

fmod LIST-of-NAT is protecting NAT. sort List. subsort Nat < List. op nil : -> List [ctor]. op ; : List List -> List [ctor assoc]. op length : List -> Nat. var N : Nat. var L : List. eq nil ; L = L. eq L ; nil = L.

eq length(nil) = 0. eq length(N) = 1. eq length(N ; L) = 1 + length(L). endfm

use the ITP to prove the following theorem:

(goal listlength : LIST-of-NAT |- A{L:List ; L’:List} ((length(L ; L’)) = (length(L) + length(L’))) .)

Note: You can retrieve both the module and the goal from the course web page.