-
Notifications
You must be signed in to change notification settings - Fork 246
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
Optimising Setoid
s/reasoning by 'rewriting' otherwise higher-dimensional equalities
#2629
Comments
While I'm generally in favour, I'd also like to know: what function is responsible for introducing the |
Indeed. I stumbled on this only when I started to look moderately in earnest at trying to tackle #2115 when I saw this particular example of the phenomenon, until I realised that everytime we build up long non-reducing chains of equations, there's always a possibility that they will be deployed in a setting where something might cause them to 'reduce'... The 'guilty party' |
I agree that this is likely not the only instance (there are tons of similar things in Maybe some kind of feature is needed in Agda, like the warnings for operators with no precedence? i.e. dump the normalized form of things of proof type? |
Maybe everything needs to be run through a |
As a sanity check, sure. As a way to build the library via meta-programming? Maybe. As a way to build the library? Definitely not! |
* fix: issue #2629 * fix: uncaught use of deprecated name * check: possible knock opportunity
Another guilty party: After a chain of reasoning (chaining via Is it OK to have all our Not sure how/if we could re-engineer the combinators to optimise away this last step? Other than, perhaps to make That has/would have the flavour of a That is: a chain of reasoning steps could/should remain as a list/chain in a (reflexive)transitive closure (in a proof-relevant bicategory/groupoid! cf. #2249 ), which only gets reified as an actual proof of an equation when reaching ... might make a fun student project!? |
That does indeed sound like the principled approach |
Right, if our combinators built up a list of steps, and then either |
Thanks @MatthewDaggitt for the endorsement. Thanks @JacquesCarette for perhaps helping take this off me. Two closing thoughts (which have been fermenting behind the scenes of the above discussion):
Regarding the second, and also thinking about the differences between HOL and Isabelle/HOL, the tension between writing a tactic which returns a complete proof, and one which incrementally builds one, seems to require a lot more proof-state management, so the 'nice' student problem might end up being... quite challenging! I look forward to seeing the results! |
Separate, but related: is it time to revisit/overhaul |
I'm also concerned with the UX aspects, so I would definitely experiment before submitting a PR. I wasn't thinking of doing this via meta-programming. We'll see. My feeling is that |
@JacquesCarette writes:
Possibly a difference of perspective worth preserving, or not, but is there a difference in the dependently-typed/proof-relevant setting between monoids (1-object categories) and categories? Or rather, between lists over a single carrier type, and object-indexed composable paths? Partiality of the composition operation perhaps, but ... from my side I wonder whether this is a distinction worth insisting upon? |
I've always thought of it as monoids being about things with shape To me, the distinction is very much there. But your final question is entirely different: is it a distinction worth insisting upon? Ah, that I don't know! That distinction helps me. And that's still not an answer to your question. |
For
Relation.Binary.PropositionalEquality
, we have (at least) the following definitional equalitiessym refl = refl
trans refl = id
(buttrans p refl
is only propositionally equal top
...)resp P refl = id
cong f refl = refl
whereas for
Setoid
s, we can form the same LHS combinations (or their mutatis mutandis variants, modulo suitable assumptions about respectfulness etc.), but for which we do not even necessarily have the above equalities even as provable equalities between proofs ... never mind any higher-dimensional coherent iterations of such ideas a la HoTT.But there are various places where it might indeed be useful/more efficient (eg in proofs of divisibility in
Algebra
) to optimise such combinations, as if those equations did hold, moreover definitionally, and without regard to the definitional biases intrans
etc. Example: inAlgebra.Properties.Magma.Divisibility
we seeNow, inlining the definitions yields
xy≈z⇒y∣z x y xy≈z = x , trans refl xy≈z
which we may then, by fiat, rewrite asxy≈z⇒y∣z x _ xy≈z = x , xy≈z
being a RHS with the correct type, moreover one which has better reduction behaviour now that we have removed the blocking non-redex
trans refl
etc.(Similar examples are available for all the various combinations of left/right respects, left/right transitivity etc.)
Proposal: to go through the library in search of such 'locally optimisable' RHS of definitions in terms of
Setoid
combinators, and suitably 'optimise' them. Cf. @JacquesCarette 's #2288The text was updated successfully, but these errors were encountered: