-
Notifications
You must be signed in to change notification settings - Fork 257
More distributivity properties for nats #2833
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
base: master
Are you sure you want to change the base?
Conversation
*-distribˡ-sum m (n ∷ ns) = trans (*-distribˡ-+ m n (sum ns)) (cong (m * n +_) (*-distribˡ-sum m ns)) | ||
|
||
*-distribʳ-sum : ∀ m ns → sum ns * m ≡ sum (map (_* m) ns) | ||
*-distribʳ-sum m [] = *-zeroˡ m |
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.
I use an explicit invocation of *-zeroˡ
rather than refl
to keep the proofs symmetric
I'm happy with the local details of this PR, but I'm starting (since already a while now) to be very dissatisfied with each of the underlying design decisions, notwithstanding my own refactorings which, like this one, have perpetuated suboptimal choices...
I'm grateful to Oleg Kiselyov for drawing my attention to various invited talks by Guy Steele over the 2010s about this in the context of parallel programming in general, and FORTRAN/Fortress in particular, but also to a (much) longer history (1970s? 1980s?) in the Dijkstra et al. lineage of so-called "Eindhoven Quantifier Notation" (discussed eg here), as well as Bertot et al. "Canonical Big Operators" in Coq/SSReflect (as it then was) in the 2000s. We can, and should, do better! (And yes, before @JacquesCarette feels obliged to remind me about about the good/perfect friend/enemy spectrum of trade-offs, I should lift this out as a separate Shoutouts also to Johannes Waldmannn for his bracing 2018 essay on lists in haskell ... |
In principle this lets us translate more easily to an arbitrary semiring
Is that relevant here? This PR is specifically about I accept that your point about a hypothetical |
Sorry @Taneb I think I should look a bit more closely (and your review request means that I will, but perhaps not straightaway ;-) I'm getting over a very unpleasant bug just atm) at your code. The |
I based the types for the list action distributivity properties on
Algebra.Properties.Semiring.Sum
, which usesVector
rather thanList
(and of course is for an arbtirarySemiring
)