I must be missing the point of the proof. The value of 'f r' is _|_. Practically speaking, it will eventually stack overflow. Why is proving anything about this interesting? Why do you think the store will ever happen on the original r?
Cheers, Thomas On Sat, Oct 16, 2010 at 6:21 PM, Ben Franksen <[email protected]> wrote: > I have a formal proof where I am stuck at a certain point. > > Suppose we have a function > > f :: IORef a -> IO b > > I want to prove that > > f r == do > s1 <- readIORef r > r' <- newIORef s1 > x <- f r' > s3 <- readIORef r' > writeIORef r s3 > return x > > What happens here is that the temporary IORef r' takes the place of the > argument r, and after we apply f to it we take its content and store it in > the original r. This should be the same as using r as argument to f in the > first place. > > How can I prove this formally? > > Cheers > Ben > > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
