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:

  1. i use complete_lattice.lfp , complete_lattice.gfp constants 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 @ type char therefore causes divergence when executed.
  2. i try make use of iterative fixpoint described kleene fixpoint theorem in directed complete partial orders. exploring, there's ccpo_class.fixp constant in theory complete_partial_order, underlying iterates constant 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:

  1. use while combinator instead of lfp/gfp in code equations and/or definitions.

  2. 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 of char set, i.e., finite_class.finite.


Comments