-
Notifications
You must be signed in to change notification settings - Fork 27
Automatically delete redundant cases/equations #135
Comments
I think this should be possible. We have code like |
I looked into using that, but the naïve way of reusing it produces quadratic code (check every prefix), and this solution seemed like it’d be quicker to pull together. Although, if we only check the last case for redundancy, and then if that was redundant check the preceding case, we’d catch some of the problems – maybe enough? |
Yes, this might work:
|
We also have to handle each argument separately, but yeah, that seems like a good outline. Particularly if we assume that this is only introduced by |
You mean in functions with multiple arguments? That’s taken care of, I believe, as
surprisingly :-) (I had a recollection that I had to prune redundant catch-all cases at the end, but looking at the code that does not seem to be true. Which is good.) |
Sometimes, when using
skip constructor
, we'll be left with redundant cases. For example:If we skip every constructor except for
NoUnfolding
, the resulting Coq code isBut since our data type has only one constructor, Coq will reject this because the
_ => true
case is redundant. We can work around this withskip equation
orskip case pattern
, but could we instead infer this automatically?(Examples and motivation from #130)
The text was updated successfully, but these errors were encountered: