Skip to content
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(SetTheory/Game/PGame): inserting an option a game #14517

Closed
wants to merge 11 commits into from

Conversation

hwatheod
Copy link
Collaborator

@hwatheod hwatheod commented Jul 8, 2024

inserting an option into a game


This PR is split out of #14498. Here, we define the operation of inserting a left or right option into a game, and prove a few standard results about it.

Open in Gitpod

@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Jul 8, 2024
Copy link

github-actions bot commented Jul 8, 2024

PR summary 1e4fe08ef0

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ insertLeft
+ insertLeft_equiv_of_lf
+ insertLeft_numeric
+ insertRight
+ insertRight_equiv_of_lf
+ insertRight_insertLeft
+ insertRight_le
+ insertRight_numeric
+ le_insertLeft
+ neg_insertLeft_neg
+ neg_insertRight_neg

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

@grunweg grunweg added awaiting-review t-logic Logic (model theory, etc) labels Jul 8, 2024
Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is about as far as I can review this, as someone not that familiar in the area. The style and naming looks good now, thanks. I'll have a quick go at shortening the proofs, but probably someone else should give this the final review to check if any obvious lemmas are missing.

@hwatheod
Copy link
Collaborator Author

I moved insertLeft_numeric and insertRight_numeric to a position after Numeric.neg so I could use Numeric.neg to write the proof of insertRight_numeric in terms of insertLeft_numeric (like @eric-wieser did for the other file)

/-- The pregame constructed by inserting `x'` as a new left option into x. -/
def insertLeft (x x' : PGame.{u}) : PGame :=
match x with
| mk xl xr xL xR => mk (xl ⊕ PUnit) xr (Sum.elim xL fun _ => x') xR
Copy link
Member

@eric-wieser eric-wieser Jul 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not instead use

Suggested change
| mk xl xr xL xR => mk (xl ⊕ PUnit) xr (Sum.elim xL fun _ => x') xR
| mk xl xr xL xR => mk (Option xl) xr (Option.rec x' xL) xR

or whatever the spelling is that works?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nicely avoids having any useless _ : Unit variables floating around

Copy link
Collaborator Author

@hwatheod hwatheod Jul 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this. First, the proof of insertLeft_numeric seems to get a little more complicated, since simp doesn't seem to work very well with Option values and I have to do an additional layer of constructor / rcases. But also, perhaps more significantly, this wouldn't generalize to the case where we want to insert a whole family xl' -> PGame, in which case we definitely need a xl ⊕ xl'. I think we would want to do that later in the development of the theory.

@kim-em
Copy link
Contributor

kim-em commented Jul 14, 2024

bors merge

@github-actions github-actions bot added the ready-to-merge This PR has been sent to bors. label Jul 14, 2024
mathlib-bors bot pushed a commit that referenced this pull request Jul 14, 2024
inserting an option into a game



Co-authored-by: Eric Wieser <[email protected]>
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 14, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(SetTheory/Game/PGame): inserting an option a game [Merged by Bors] - feat(SetTheory/Game/PGame): inserting an option a game Jul 14, 2024
@mathlib-bors mathlib-bors bot closed this Jul 14, 2024
@mathlib-bors mathlib-bors bot deleted the hwatheod/insert-left branch July 14, 2024 01:52
@adomani adomani mentioned this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! ready-to-merge This PR has been sent to bors. t-logic Logic (model theory, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants