[isabelle-dev] An note on code generator bookkeeping and the code generator preprocessor [was: Locale interpretation with mixins]
florian.haftmann at informatik.tu-muenchen.de
Thu Oct 4 14:39:02 CEST 2012
> The current infrastructure has only a preprocessor applied *after* the
> internal bookkeeping (for reasons I will explain in a separate, long
> promised mail), so this would add further complexity here.
What sets the code generator apart from other tools is that theorems are
never stand-alone but grouped according to their equation head. E.g.
the two theorems
f (Suc n) = …
f 0 = …
belong inherently together, resulting in Haskell into something like
f :: Nat -> …
f (Suc n) = …
f Zero = …
Compare this e.g. to the simplifier where both theorems can stand for
Internally, code theorems are declared as singleton declarations
(typically via attributes), e.g.
"f 0= …"
"f (Suc n) = …"
results in two separate declarations.
When code generation is issued, theorems are grouped together according
to their equation head and only then passed to the preprocesser, which
already requires the grouped view since it must be able to transform
e.g. the equations from above into
f n = (if n = 0 … else …)
This also means that some checks which are only valid on the grouped
view are only to be carried out after preprocessing, not immediately
after declaration. The singleton declaration / grouped equations
mismatch has also some other funny consequences, e.g. non-standard
add/del behaviour and own ideas how the order of equations is determined
Life would have been much more easier from the very beginning if the
code generator would only have accepted simultaneous declarations. But I
don't think this is possible. Either one would have to sacrifice the
simple lightweight declaration
"…" … "…" <proof>
(which can also be annotated to theorems which make sense as »normal«
theorem beyond code generation) an instead having e.g. the more explicit
by (fact …)+
Or attributes would be changed to take simultaneous lists of theorems
instead of single ones, but I guess a such fundamental change of the
framework is not feasible.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 259 bytes
Desc: OpenPGP digital signature
More information about the isabelle-dev