agda-stdlib icon indicating copy to clipboard operation
agda-stdlib copied to clipboard

Why is `Data.List.Relation.Binary.Subset.Setoid.Properties` not parametrized on the `Setoid` as a whole

Open andreasabel opened this issue 1 year ago • 6 comments

Module Data.List.Relation.Binary.Subset.Setoid is parametrized on a Setoid, but its Properties module not: https://github.com/agda/agda-stdlib/blob/bfd7a7bda8ee55e8d319600c974a3ca7151d752b/src/Data/List/Relation/Binary/Subset/Setoid/Properties.agda#L9 Instead, each function is parametrized there individually, via anonymous modules. Is there a reason why it is organized like this?

I would have expected to open the Properties module in the same way as its parent module.

  • https://github.com/agda/agda/issues/7294?notification_referrer_id=NT_kwDOABGgkrMxMDg0NzE1Nzg3ODoxMTU1MjE4#issuecomment-2135731299

andreasabel avatar May 28 '24 17:05 andreasabel

This tends to be for historical reasons rather than any 'good' reason. Evolution of the library happens haphazardly sometimes (no matter how hard we try to review PRs).

In other words, I'd call this a plain bug awaiting a PR to fix it.

JacquesCarette avatar May 28 '24 18:05 JacquesCarette

No, there's a good reason for all such Properties modules being designed this way. If you parameterise it by a single setoid, then you can't prove properties of functions that move between different types, e.g. map.

MatthewDaggitt avatar May 29 '24 03:05 MatthewDaggitt

But as @omelkonian writes on #2389 , this is not the case for eg Data.List.Relation.Binary.Permutation.Setoid.Properties, leading to undesirable consequences... wrt map :-( so @JacquesCarette 's point about historical/legacy inconsistency stands.

Ditto. The proposed addition in #2393 ...?

jamesmckinna avatar May 29 '24 07:05 jamesmckinna

No, there's a good reason for all such Properties modules being designed this way. If you parameterise it by a single setoid, then you can't prove properties of functions that move between different types, e.g. map.

Is this design principle documented anywhere?

jamesmckinna avatar Jun 01 '24 15:06 jamesmckinna

But as @omelkonian https://github.com/agda/agda-stdlib/pull/2389#discussion_r1608424533, this is not the case for eg Data.List.Relation.Binary.Permutation.Setoid.Properties, leading to undesirable consequences... wrt map :-(

Yes that should really be fixed.

Is this design principle documented anywhere?

No, sadly not :sweat:

MatthewDaggitt avatar Jun 08 '24 02:06 MatthewDaggitt

Similarly, for the parametrisation of ...Propositional.Properties modules? cf. #2514

jamesmckinna avatar Jan 03 '25 07:01 jamesmckinna