MagicHaskeller-0.9.6.7: Automatic inductive functional programmer by systematic search

Safe HaskellNone
LanguageHaskell98

MagicHaskeller.ProgGenSF

Synopsis

Documentation

data PGSF e Source #

Program generator with synergetic filtration. This program generator employs filtration by random testing, and rarely generate semantically equivalent expressions more than once, while different expressions will eventually appear (for most of the types, represented with Prelude types, whose arguments are instance of Arbitrary and which return instance of Ord). The idea is to apply random numbers to the generated expressions, compute the quotient set of the resulting values at each depth of the search tree, and adopt the complete system of representatives for the depth and push the remaining expressions to one step deeper in the search tree. (Thus, adoption of expressions that may be equivalent to another already-generated-expression will be postponed until their "uniqueness" is proved.) As a result, (unlike ProgGen,) expressions with size N may not appear at depth N but some deeper place.

ProgGenSF is more efficient along with a middle-sized primitive set (like reallyall found in LibTH.hs), but is slower than ProgGen for a small-sized one.

Also note that ProgGenSF depends on hard use of unsafe* stuff, so if there is a bug, it may segfault....

Constructors

PGSF (MemoDeb e) TypeTrie (ExpTrie e) 

Instances

Expression e => ProgramGenerator (PGSF e) Source # 

Methods

mkTrie :: Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> PGSF e Source #

mkTrieOpt :: Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> [[Typed [CoreExpr]]] -> PGSF e Source #

matchingPrograms :: Search m => Type -> PGSF e -> m AnnExpr Source #

matchingProgramsWOAbsents :: Search m => Type -> PGSF e -> m AnnExpr Source #

unifyingPrograms :: Search m => Type -> PGSF e -> m AnnExpr Source #

Expression e => WithCommon (PGSF e) Source # 

freezePS :: Type -> PriorSubsts Recomp Type -> Matrix (Type, Subst, TyVar) Source #

funApSub_ :: (Search m, Monoid a) => (Type -> PriorSubsts m ()) -> (Type -> PriorSubsts m a) -> (Type -> PriorSubsts m a) -> Type -> PriorSubsts m a Source #

funApSub_spec :: (Monoid a, Search m) => (Type -> PriorSubsts m ()) -> (Type -> PriorSubsts m a) -> Type -> PriorSubsts m a Source #

lookupNormalized :: (Functor m, MonadPlus m) => (Type -> m (e, Subst, TyVar)) -> [Type] -> Type -> PriorSubsts m e Source #

tokoro10fst :: (Eq k, Ord k) => [(k, s, i)] -> [(k, s, i)] Source #

mkTrieOptSFIO :: Expression e => Common -> [Typed [CoreExpr]] -> [[Typed [CoreExpr]]] -> [[Typed [CoreExpr]]] -> IO (PGSF e) Source #