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
[Merged by Bors] - feat(set_theory/game): impartial games and the Sprague-Grundy theorem #3855
Conversation
Co-authored-by: Aaron Anderson <65780815+awainverse@users.noreply.github.com>
src/set_theory/game/nim.lean
Outdated
|
||
/-- The definition of single-heap nim, which can be viewed as a pile of stones where each player can | ||
take a positive number of stones from it on their turn. -/ | ||
noncomputable def nim : ordinal → pgame |
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 get a warning definition 'nim' was incorrectly marked as noncomputable
here. Do you?
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.
However removing it gives the error rec_fn_macro only allowed in meta definitions
... Sounds like it may be a Lean bug?
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 get this too, it should be noncomputable due to the quotient.out
, right? Where would be best to flag this?
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.
Can you try to minimise this as an example? Ideally we could even get a MWE that doesn't even import mathlib, but it would suffice to get a MWE that just depends on the current mathlib. Can you try just copy and pasting this definition into a file that just imports pgame
, nth_rewrite
and ordinal
? Check also if the from
blocks can by replaced by sorry without making the problem go away.
After that, create a new issue here on github, and make a post on zulip to bring it to people's attention.
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.
(Unfortunately I think we better get to the bottom of this before merging, as we don't want warning in mathlib.)
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.
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.
Mario has provided a workaround at https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/neither.20computable.20nor.20noncomputable.
This reverts commit eb05399.
Fantastic, thanks for this! 🎉 bors merge |
…#3855) Co-authored-by: foxthomson <11833933+foxthomson@users.noreply.github.com>
Pull request successfully merged into master. Build succeeded: |
* Misc. style cleanups and code golf * Changed naming and namespace to adhere more closely to the naming convention * Changed `impartial` to be a `class`. I am aware that @semorrison explicitly requested not to make `impartial` a class in the #3855, but after working with the definition a bit I concluded that making it a class is worth it, simply because writing `impartial_add (nim_impartial _) (nim_impartial _)` gets annoying quite quickly, but also because you tend to get goal states of the form `Grundy_value _ = Grundy_value _`. By making `impartial` a class and making the game argument explicit, these goal states look like `grundy_value G = grundy_value H`, which is much nicer to work with.
* Misc. style cleanups and code golf * Changed naming and namespace to adhere more closely to the naming convention * Changed `impartial` to be a `class`. I am aware that @semorrison explicitly requested not to make `impartial` a class in the #3855, but after working with the definition a bit I concluded that making it a class is worth it, simply because writing `impartial_add (nim_impartial _) (nim_impartial _)` gets annoying quite quickly, but also because you tend to get goal states of the form `Grundy_value _ = Grundy_value _`. By making `impartial` a class and making the game argument explicit, these goal states look like `grundy_value G = grundy_value H`, which is much nicer to work with.
* Misc. style cleanups and code golf * Changed naming and namespace to adhere more closely to the naming convention * Changed `impartial` to be a `class`. I am aware that @semorrison explicitly requested not to make `impartial` a class in the #3855, but after working with the definition a bit I concluded that making it a class is worth it, simply because writing `impartial_add (nim_impartial _) (nim_impartial _)` gets annoying quite quickly, but also because you tend to get goal states of the form `Grundy_value _ = Grundy_value _`. By making `impartial` a class and making the game argument explicit, these goal states look like `grundy_value G = grundy_value H`, which is much nicer to work with.
Blocked by leanprover-community/lean#451