-
Notifications
You must be signed in to change notification settings - Fork 242
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
[ add ] Module ⊆-Reasoning
for Data.List.Relation.Binary.Sublist.*
#2527
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code as is seems fine to me - so I'm not quite understanding what 'failure' the second point is about?
I'm pretty sure one can use Relation.Binary.Reasoning.Preorder
without the Syntax
part, if one is doing locally as opposed to building up externally-visible combinators.
Second things first:
Fine. Happy to leave things as they are. My comment stems from the sense that the |
First thing second:
As I glimpse/see/understand it, there is a potential [ DRY ] opportunity to share the behaviour between |
Ahh, now I see it (the problem, that is). I'll try to circle back to this before I get swamped with term things. |
While fixing the |
⊆-Reasoning
for Data.List.Relation.Binary.Sublist.*⊆-Reasoning
for Data.List.Relation.Binary.Sublist.*
Open a separate issue for that? I would think a separate PR - we don't want to push too many things to 'release time' otherwise it makes putting out a release too much work. |
About DRY: as far as I can see, it's more than just instantiating the relation, a lot of the 'related' properties in the two files also differ in their uses of which equivalence relation is at play ( If anything's going to be done about this, it is for sure a non-trivial v3.0 job. |
Thanks @JacquesCarette . I'd be happy to leave things as they are, with distinct |
Were you just thinking about the reasoning modules? I was looking at the whole file. |
Ah!? Because the PR at hand is only concerned with adding the new |
Hmm, why doesn't module ⊆-Reasoning where
open HeteroProperties.⊆-Reasoning ⊆-preorder public work? My tests make it feel like that accomplishes the same. Pushed to your branch. |
Interesting! Thanks for the prompt to play around a bit more myself... and I think I disagree with you. The But this did prompt me to investigate whether Relation.Binary.Properties.Setoid.≈-isPreorder S : IsPreorder _≈_ _≈_ the (canonical!) UPDATED: I think this is the correct choice for reasoning wrt Relation.Binary.Properties.Setoid.isPreorder S : IsPreorder _≡_ _≈_ ??? |
Got my commits slightly out of order just now, but have now also refactored the proof of the lemma introduced in #2524 to use the new xs∈xss⇒xs⊆concat[xss] : xs ∈ xss → xs ⊆ concat xss
xs∈xss⇒xs⊆concat[xss] {xs = xs} {xss = xss} xs∈xss = begin
xs ⊆⟨ ⊆-reflexive (≋-reflexive (sym (++-identityʳ xs))) ⟩
xs ++ [] ⊆⟨ concat⁺ (map-≋ ⊆-reflexive (from∈-≋ xs∈xss)) ⟩
concat xss ∎
where open ⊆-Reasoning but there are clearly still some UX aspects to iron out, because the combinators for
|
Oops - thanks for spotting that. Subtle. The other parts might be related to the |
…d a 4th argument.
The reason you can't do those steps is because in open ≲-Reasoning (preorder ≲) public
hiding (step-≈; step-≈˘; step-≈-⟩; step-≈-⟨; step-≲; step-∼)
renaming (≲-go to ⊆-go; ≈-go to ≋-go) After revealing that, then at least the proof could be simplified to xs∈xss⇒xs⊆concat[xss] {xs = xs} {xss = xss} xs∈xss = begin
xs ≈⟨ ≋-reflexive (++-identityʳ xs) ⟨
xs ++ [] ⊆⟨ concat⁺ (map-≋ ⊆-reflexive (from∈-≋ xs∈xss)) ⟩
concat xss ∎
where open ⊆-Reasoning Then I tried the ≋ step. That gave very weird errors until I figured out that that particular module takes 4 arguments and not merely the 3 that it was given! Once I managed to fix that, the combinators worked, but I wasn't able to use them to simplify things. My 'improvements' pushed. |
See previous about being tired/making mistakes! I had been too quick to emulate the code for Thanks for pushing the changes, and paying more attention than I could manage to the structure of reasoning modules... ;-) |
src/Data/List/Relation/Binary/Sublist/Heterogeneous/Properties.agda
Outdated
Show resolved
Hide resolved
This wasn't "paying more attention", which would have been the case if I were writing the code. This was sleuthing, because I was in 'debugging mode'. Something that I rather enjoy (and, sadly, it seems few programmers like this kind of investigation). |
= ⊆-trans (⊆-reflexive (≋-reflexive (sym (++-identityʳ xs)))) | ||
(concat⁺ (map-≋ ⊆-reflexive (from∈-≋ xs∈xss))) | ||
xs∈xss⇒xs⊆concat[xss] {xs = xs} {xss = xss} xs∈xss = begin | ||
xs ≈⟨ ≋-reflexive (++-identityʳ xs) ⟨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Hopefully that's now tidied things up enough after the merge conflict resolution and @JacquesCarette 's improvements. |
Fixes #2526
DRAFT until the following are sorted out:
Propositional
instantiation UPDATED: I think this does 'just' work by import fromSetoid
for the propositional equalitysetoid
...?Setoid
instantiation to delegate appropriately toHeterogeneous
, but I can't quite figure out whether the relevantPreorder
bundles match up (difference betweenRelation.Binary.Properties.Setoid.≈-isPreorder
andRelation.Binary.Properties.Setoid.isPreorder
... hidden underData.List.Relation.Binary.Equality.Setoid
viaPointwise
?)Issues:
A second set of eyes would be helpful re the second point above! (and even the first!?)
Each implementation relies on an import of each of:
Relation.Binary.Reasoning.Preorder
Relation.Binary.Reasoning.Syntax
Is there ever a reason not to have one without the other? (ie. should the specialised
Relation.Binary.Reasoning.Preorder
reexport thesyntax
directly?)