-
Notifications
You must be signed in to change notification settings - Fork 234
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
Remove all external use of less-than-or-equal
beyond Data.Nat.*
#2256
Conversation
Re: revising the design On reflection, I think the proof pattern alluded to above could be improved off-the-bat by:
≤⇒≤″ : _≤_ ⇒ _≤″_
≤⇒≤″ = less-than-or-equal ∘ m+[n∸m]≡n
-- corollary
≤-proof : ∀ {m n} (le : m ≤ n) → ∃[ k ] m + k ≡ n
≤-proof le = _ , ≤″-proof (≤⇒≤″ le)
pattern ≤-offset k = k , refl
pattern <-offset k = ≤-offset k
-- equivalence to _≤_
≤″⇒≤ : _≤″_ ⇒ _≤_
≤″⇒≤ (≤″-offset k) = m≤m+n _ k
with ℕₚ.≤-offset k ← ℕₚ.≤-proof (recompute (_ ℕₚ.≤? _) m≤n) thereby encapsulating all mention even of |
I would be a definite fan of doing this in two stages, i.e. first pull this in, and then your further improvements later, when they land. |
OK, so let's merge this as it stands, and then I'll file a followup? Are you happy for me to hit 'merge'? |
Well, I still think it shouldn't be the author who merges - but I'm happy to do it. |
I agree re: self-merging, so I hadn't done so... ;-) |
…2256) * removed all external use of `less-than-or-equal` beyond `Data.Nat.*` * use of `variable`s
Following up on #2216 / #2217 (and #2250 ) with a 'pure' refactoring PR (so: no
CHANGELOG
entry required at this stage) which localises all uses of the retained-for-backwards-compatibilitypattern
synonymless-than-or-equal
toData.Nat.Base
,Data.Nat.Properties
,Data.Nat.Properties/WithK
.Outstanding issues (maybe):
Data.Nat
? or elsewhere?), which would require aCHANGELOG
entry;Vec
lengths inpadRight
,padBoth
etc. at present userewrite
, but it might be cleaner to useVec.cast
with the appropriate equality (shoutout to @JacquesCarette for this);suggests that the design of the datatype might be revisited, to optimise for computing the offset
k
?