Thanks for all your help but I did it the following way eventually: First I restricted my bags to contain only elements with non-zero multiplicity module bags open util/natural open util/relation sig Element{} sig Bag{ elements: Element -> one Natural }{ all e: Element.elements | e != Zero } And...

proof,formal-methods,post-conditions,proof-of-correctness,hoare-logic

This question seems so simple that I am getting completely lost, what exactly is it asking for? The question is asking for you to formally prove that the program behaves as specified, by the rigorous application of a set of rules decided on in advance (as opposed to reading...

haskell,recursion,functional-programming,lazy-evaluation,formal-methods

Statutory Calculus Warning. The basic answer to this question involves specialising a standard recursion scheme. But I got a bit carried away pulling at the thread of it. Things take a more abstract turn as I seek to apply the same method to structures other than lists. I end up...