

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


In each problem below, you will define a theory and verify properties im- plied by that theory. You may turn in a single theory for Problems 1 through
Remember that list types in Isabelle can be imported by including the M ain theory in your header. (You should include M ain in virtually every Isabelle theory that you write.)
(a) add - adds an element to the end of a queue (b) empty - the empty queue itself (c) f irst - returns the first element of a queue (d) rest - returns all the elements of a queue except the first (e) isEmpty - returns true when a queue is empty (f) size - returns the size of a queue
(a) isEmpty(q) =โ rest(add(x, q)) = q (b) isEmpty(q) =โ add(x, rest(add(y, q))) = add(x, q) (c) rest(rest(add(x, add(y, empty)))) == rest(add(y, rest(add(x, empty))))
(d) not(isEmpty(add(x, q))) (e) size(q) = 0 =โ isEmpty(q)