Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I think I have you beat on that now lol
What's the motivation behind this kata? I don't understand why we're proving equality of a bunch of proof terms.
n
with a concrete value (e.g.S (S O)
), butn
is not being matched, so still no reduction is available. So, e.g.,strange 0
andstrange 1
are obviously not alpha-convertible. (Try using "Compute strange 0" to see.)u
withtt
does enable match-reduction, yielding(fun _ => tt) n
, followed by beta-reduction, to give justtt
.I loved the simplicity of this kata. Very cool.
Nice Kata, thanks! My approach is by far the most convoluted to date (-X
If all goes well, the Kata should be approvable after 1-2 more satisfaction and ranking votes. Looking forward to more Coq Kata authored by you ;-)
Thanks, that's very helpful. (FYI, the "Insert Example" kata still uses the old-style tests, which is why this kata originally used that style.)
Please use the Codewars Coq plugin for tests:
Thanks for the suggestion, I'll keep that in mind when authoring future Kata. The current efficient implementation is a direct translation of my JavaScript solution to the original Kata which did not take formalization considerations into account.
It's not a problem for the proof, but isn't it a bit odd that the optimized version uses
minus
? I would have expected something more along the lines ofThis way the same implementation can be used for types that support some form of addition but not subtraction. (e.g. You could compute all suffixes of a list.) It also uses fewer arithmetic operations because of not making the initial call to
sum
.Thanks! It should be fixed now. (The reason it slipped through is that I didn't realize that clicking "Validate Solution" only checks whichever test tab is currently selected.)
Actual tests: