Hi Christian,

> What I did in the attached theory files is essentially make a copy of
> the Imperative/HOL development using "'a Heap" and adding an additional
> phantom type parameter 's (for state) *everywhere* (i.e., heap monad,
> array type and operations, ref type and operations, ...). Finally there
> is a function "runST :: (unit, 'a) st => 'a" (where "('s, 'a) st" more
> or less corresponds to the previous "'a Heap") which is code generated
> to Haskell's "runST :: (forall s. ST s a) -> a". It's logical definition
> is "runST c = (case execute c initial_state of Some (x, _) => x)" where
> "initial_state" is "State ST_Heap.empty" for the new datatypes
> 
>   's state = State (heap : heap) (*heap is almost the same as the
> original heap)
> 
> and
> 
>   (dead 's, 'a) st = ST (execute : "'s state => ('a * 's state) option")

thanks for trying that out.

Adding the formal state type everywhere seems indeed a suitable solution.

I do not have time at the moment to study the sources in detail, but I
am asking myself two questions:

a) Can the same development still be used to generate code for ML and
Scala?  I guess yes (except runST of course).  The only thing to add is
maybe a small adaptation layer which adds arrays and refs with phantom
types also.

b) I am uncertain whether the whole state/st cruft is really necessary.

Cheers,
        Florian

-- 

PGP available:
http://home.informatik.tu-muenchen.de/haftmann/pgp/florian_haftmann_at_informatik_tu_muenchen_de

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
isabelle-dev mailing list
isabelle-...@in.tum.de
https://mailmanbroy.informatik.tu-muenchen.de/mailman/listinfo/isabelle-dev

Reply via email to