isabelle - "Efficient" least- and greatest fixpoint computations? -
i trying compute 2 finite sets of enumerable type (let's char) using least- , greatest- fixpoint computation, respectively. want definitions extractable sml, , "semi-efficient" when executed. options?
from exploring hol library , playing around code generation, have following observations:
- i use
complete_lattice.lfp,complete_lattice.gfpconstants pair of additional monotone functions compute sets, in fact doing. code generation work these constants, code produced horribly inefficient, , if understand generated sml code correctly performing exhaustive search on every possible set in powerset of characters. use, no matter how simple, of these 2 constants @ typechartherefore causes divergence when executed. - i try make use of iterative fixpoint described kleene fixpoint theorem in directed complete partial orders. exploring, there's
ccpo_class.fixpconstant in theorycomplete_partial_order, underlyingiteratesconstant defined in terms of has no associated code equations, , code cannot extracted.
are there existing fixpoint combinators hiding somewhere, suitable use finite sets, produce semi-efficient code code generation have missed?
none of general fixpoint combinators in isabelle's standard library meant used directly code extraction because construction general usable in practice. (there 1 in theory ~~/src/hol/library/bourbaki_witt_fixpoint.) theory ~~/src/hol/library/while_combinator connects lfp , gfp fixpoints iterative implementation looking for, see theorems lfp_while_lattice , gfp_while_lattice. these characterisations have precondition function monotone, cannot used code equations directly. have 2 options:
use
whilecombinator instead oflfp/gfpin code equations and/or definitions.tell code preprocessor use
lfp_while_lattice[code_unfold]equation. works if add rules preprocessor needs prove assumptions of these equations instances @ should apply. hence, recommend add[code_unfold]monotonicity statement of function , theorem prove finiteness ofchar set, i.e.,finite_class.finite.
Comments
Post a Comment