[ refactor ] make i ≢ j argument to Data.Fin.Base.punchOut irrelevant#2790
[ refactor ] make i ≢ j argument to Data.Fin.Base.punchOut irrelevant#2790jamesmckinna wants to merge 19 commits intoagda:masterfrom
i ≢ j argument to Data.Fin.Base.punchOut irrelevant#2790Conversation
JacquesCarette
left a comment
There was a problem hiding this comment.
I'm torn over this one. The code is fine. It's the pain that goes along with the design that's causing me to have doubts.
It seems that Agda is much weaker at inferring irrelevant things, so by explicitly making some things irrelevant, we're making our lives harder. So I wonder if the extra precision is worth the pain.
I, too, am torn. I think that it is in any case instructive to uncover such gnarly cases... but on balance, I think the equations proofs that do fall to UPDATED: some sleep, and reconsideration, shows that the old proofs can be simplified! Indeed, I've begun to wonder if the right refactoring would go all the way, and simply have punchOut-cong : ∀ (i : Fin (suc n)) {j k} .{i≢j : i ≢ j} .{i≢k : i ≢ k} →
j ≡ k → punchOut i≢j ≡ punchOut i≢k
punchOut-cong i refl = refland with it the deprecation of |
JacquesCarette
left a comment
There was a problem hiding this comment.
The cleaned up proofs are very nice. But still dubious overall.
Well, do matters improve if instead we deprecate the existing version of punchOut : ∀ (i j : Fin (suc n)) → .(i ≢ j) → Fin nor even punchOut-< : ∀ (i j : Fin (suc n)) → .(i < j) → Fin n? |
|
This is definitely a breaking change right as you're forced to change the types of e.g. Is there anyway we can see the actual breaking changes (i.e. those that we're forced to make from this change) vs the additional refactoring that is unlocked by this? |
|
@MatthewDaggitt writes:
Well, on that basis, so too is the type of the function itself changed? I think that this is (yet) another instance where the line between
seems a bit hard for me to draw, and hence whether it should be v2.4 or v3.0?
Oooh, that's tricky. Hmmm... scratches head!? I might have make a clean version, and see what breaks? |
JacquesCarette
left a comment
There was a problem hiding this comment.
I'm willing to consider this a bug fix. I know opinions differ on that front (legitimately).
|
Ah right, sorry I misunderstood the change to |
Another downstream consequence of #2785 .
This time the ergonomics are slightly less clear as to whether this improves matters, but the definitional proof-irrelevance pays off in a couple of places, but with a corresponding need to be explicit about the exact proof of inequality in others. Perhaps these proofs can all be simplified further, but I went for the minimal fixes necessary.
UPDATED Perhaps they can! (See below)
I think, as @JacquesCarette touches on below, the real reason this might be problematic is that we end up with a function of three arguments, two of which are implicit, and the third of which is now irrelevant, so it's perhaps not so surprising that in various places, Agda needs a nudge to be able to figure things out...
UPDATED: wait on the merge of #2794 in order to be able to simplify proofs of monotonicity as well...? DONE