[Haskell-cafe] Re: Help with Bird problem 3.3.3

Heinrich Apfelmus apfelmus at quantentunnel.de
Fri Jun 11 04:28:21 EDT 2010


Günther Schmidt wrote:
> 
> I'm just re-reading the book again, this time doing the exercises though :)
> 
> Is there a site with solutions for the exercises?

Unless you count the haskell-cafe and beginners mailing lists as sites,
I don't know any sites which have the solutions. ;)


Problem 3.3.3: Construct a program for division from the specification

  (m * n) / n = m

and prove that it's correct.


Sketch of a solution: To define  a / n , the usual approach of
subtracting  n  from the first argument until something less than  n
remains will work. Correctness can then be proven by induction on  m .



Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



More information about the Haskell-Cafe mailing list