Program extraction using native integers/words (not bignums) from Isabelle theory -
this question comes in context isabelle used formal software development in mind more pure maths theorization in mind (and standalone developer's context).
seems @ best, sml programs generated isabelle theory, use sml's intinf.int
, not native integer type, int.int
; if code_target_int
, code_binary_nat
or code_target_nat
used. investigation of these theories sources seems confirm it's can do. native platform integers may required multiple reasons, including efficiency , case sml imperative program optionally translated imperative language subset (ex. c or ada), relevant when theory relies on imperative_hol
theory. codegen.pdf
document comes isabelle distribution, did not it, except in suggesting first of options below.
options may be:
- not using isabelle's
int
,nat
, re‑create new numeric type scratch, usecode_printing
commands (withtype_constructor
,constant
) give native platform representation , operations (implies inclusion of range limitations in way in theory) : must tedious, although unlikely error‑prone hope, due formal environment. note seems feasible isabelle's ownint
,nat
… makes code generation fails, , nothing tells constants missing incode_printing
command. - if sml program compiled directly (ex. mlton), tweak sml environment replacement
intinf
structure : may unsafe or not feasible, , still requires embed range limitations in theory, previous options may better one. - touch generated program change
intinf
int
: easy, safe? (at least,intinf
implements same signatureint
do, may it's safe). above, requires specifies bounds in theory in way, it's ok this. - dive isabelle internals : surely unreasonable, worse second option.
- there exist
word
theory, according readings, it's seems not suited purpose.
are other known options not listed here? comments on listed options?
if there no ready‑to‑cook solutions (i feel there no @ time), hints or tracks best known? (ex. links documents, mentions of concepts).
update
points #2 , #3 of list, may ok (if is) if there single integer type. if program use more one, it's not applicable.
directly generating native words isabelle int
unsound, because formalisation not take overflow account exists in reality.
it looks afp entry native_word
want, though: http://afp.sourceforge.net/entries/native_word.shtml
Comments
Post a Comment