Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-calculate and filter out combinations of unfortunate orderings, especially given indices #145

Open
buzden opened this issue Apr 23, 2024 · 0 comments
Labels
code: enhancement New feature or improvement derive: least-effort Relates to the `LeastEffort` derivation algorithm issue: compilation error When compilation error raises because of the library issue: performance When work takes too much resources part: derivation Related to automated derivation of generators part: generators Related to generators status: feature request Request for new functionality or improvement

Comments

@buzden
Copy link
Owner

buzden commented Apr 23, 2024

In the case when we have a data type with a constructor with (at least) two arguments that depend on one, say

data X : Type where
  MkX : Y n -> Z n -> X

we treat both types Y and Z equally, and try both

  do ...
     (n ** y) <- genY
     z <- genZn n
     pure $ MkX {n} y z

and

  do ...
     (n ** z) <- genZ
     y <- genYn n
     pure $ MkX {n} y z

in usual LeastEffort, and arbitrary one of those two when simplificationHack option it turned on.

But in case when, say, Y has n as index, and Z has n as a parameter, it's much better to prefer first generation of Y and only after Z with the given n. The same is applicable when, say, Y has only constructors and free variables in its indices, when Z has both constructors, free variables and calls non-reversible functions -- in this case, we should first generate value for Z along with some n, and have given arguments for Y -- because we can't generate a generator for Z with the given n because of those non-reversible functions.

To do this, we could filter out unfortunate orders in the LeastEffort. First we should try to filter out those orders, when any given parameter is actually an index. If we get an empty list of orders, then we should start from the begining and filter out only those, which contains calls to non-reversible functions in indices. And only after that, we should apply the simplification hack, if this option is turned on.

This both would increase generation time, because of reduced runtime filtering, and in some cases it would allow some functions in indices where in other cases we how get an error of unsupported data type.

I wonder if this is actually always fixed by solution of #55 or not.

@buzden buzden added code: enhancement New feature or improvement part: generators Related to generators part: derivation Related to automated derivation of generators status: feature request Request for new functionality or improvement issue: compilation error When compilation error raises because of the library issue: performance When work takes too much resources derive: least-effort Relates to the `LeastEffort` derivation algorithm labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code: enhancement New feature or improvement derive: least-effort Relates to the `LeastEffort` derivation algorithm issue: compilation error When compilation error raises because of the library issue: performance When work takes too much resources part: derivation Related to automated derivation of generators part: generators Related to generators status: feature request Request for new functionality or improvement
Projects
None yet
Development

No branches or pull requests

1 participant