-
Notifications
You must be signed in to change notification settings - Fork 7
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
Lengths of generated lists of derived sorted lists are too short #128
Comments
The reason for such behaviour is the following. Data definitions are the following (ignoring forward declarations): data SortedList : Type where
Nil : SortedList
(::) : (x : Nat) -> (xs : SortedList) -> FirstGT x xs => SortedList
data FirstGT : Nat -> SortedList -> Type where
E : FirstGT n []
NE : x `GT` n -> FirstGT n $ (x::xs) @{prf} By definition of |
One possible solution for this would be tuning frequences not only for recursive constructors, but for constructors that are potentially indexed by self-recursive constructors, in case when these indices are generated, not given. Potentially indexed means the following: if we have a data type, say, data Indexed : SortedList -> Type where
Zero : Indexed []
Many : Indexed (x::xs)
Any : Indexed xs then in the generator Anyway, this idea needs a good thought, and I'm not sure this is a correct way to proceed. |
Two more thoughts:
|
The current modification of the criteria is the following. Consider all the names in all generated indices of the constructor-under-the-question (1). Those names are either constructor's arguments (2), or some external names (3). If any external name (2) is a recursive constructor or a non-constructor, then we consider the whole original constructor (1) to be potentially recursively-indexed. If not, then consider types of all mentioned as (2), and look if their types are recursive or not. If yes, then consider the constructor (1) to be potentitally recursively-indexed. If both checks are false, consider it as a non-recursive constructor. EDIT: no, this idea is wrong. For example, using this we'll get equal probabilities for both constructors of I was trying to formulate universal criteria covering cases like data Prop : List X -> Type where
P1 : Prop [] -- non-recursive
P2 : Prop (x::xs) -- indexed by recursive
P3 : Prop xs -- indexed by potentially recursive
P4 : Prop (externalFun x) -- indexed by potentially recursive
P5 : (f : Y -> List X) -> (x : Y) -> Prop (f x) -- indexed by potentially recursive |
The latest thought was that we should first clear the common application prefix of index expressions, so that, say, data X : Nat -> Type where
X1 : X 1
X2 : X 2 since the index has expressions Now, I'm feeling like a blind rat searching for an exit in a maze.... More suprisingly, I realised that my original explanation of bad distribution in the |
In the
sorted-list
example, there is a data type for sorted list, which has a derived generator. For some reason, this derived generator always produces lists of length ~2-3, sometimes 4, not more, even of fuel is over say, 100. Influence of the fuel to the values inside lists are visible clearly, but somewhy this does not affect the length of the generated lists.The text was updated successfully, but these errors were encountered: