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(data/bool/basic): Kaminski's equation #14159

Closed
wants to merge 3 commits into from

Conversation

slerpyyy
Copy link
Collaborator

bool.apply_apply_apply : ∀ (f : bool → bool) (x : bool), f (f (f x)) = f x


Open in Gitpod

bool.apply_apply_apply : ∀ (f : bool → bool) (x : bool), f (f (f x)) = f x
@slerpyyy slerpyyy added the easy < 20s of review time. See the lifecycle page for guidelines. label May 15, 2022
Copy link
Collaborator

@bryangingechen bryangingechen left a comment

Choose a reason for hiding this comment

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

Just one minor suggestion. Thanks!
bors d+

src/data/bool/basic.lean Outdated Show resolved Hide resolved
@bors
Copy link

bors bot commented May 15, 2022

✌️ slerpyyy can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@leanprover-community-bot-assistant leanprover-community-bot-assistant added the delegated The PR author may merge after reviewing final suggestions. label May 15, 2022
Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
Comment on lines +229 to +230
theorem apply_apply_apply (f : bool → bool) (x : bool) : f (f (f x)) = f x :=
by cases x; cases h₁ : f tt; cases h₂ : f ff; simp only [h₁, h₂]
Copy link
Member

Choose a reason for hiding this comment

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

Does this shorter proof work in this file?

Suggested change
theorem apply_apply_apply (f : bool → bool) (x : bool) : f (f (f x)) = f x :=
by cases x; cases h₁ : f tt; cases h₂ : f ff; simp only [h₁, h₂]
theorem apply_apply_apply : ∀ (f : bool → bool) (x : bool), f (f (f x)) = f x :=
dec_trivial

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I checked locally and it seems like it doesn't

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Neither does Patrick Johnson's fin_cases proof

Copy link
Collaborator

Choose a reason for hiding this comment

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

@eric-wieser What imports did that need? This module is a mathlib root (no imports!)

Copy link
Member

Choose a reason for hiding this comment

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

It needs data.fintype.basic:

import data.fintype.basic

lemma foo : ∀ (f : bool → bool) {x : bool}, f (f (f x)) = f x :=
dec_trivial

as it uses pi.fintype.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Surely this would make for a nice (if niche) simp theorem?

Copy link
Member

@eric-wieser eric-wieser May 15, 2022

Choose a reason for hiding this comment

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

It's not valid for simp because the head symbol is not a constant, so lean can infer f = fun x, x and get stuck in a loop

@eric-wieser
Copy link
Member

eric-wieser commented May 15, 2022

We should probably wait for the ongoing Zulip discussion about whether "Kaminski's equation" is a reasonable name to resolve before merging this.

@slerpyyy
Copy link
Collaborator Author

It seems there is no more discussion about this so I will go ahead and merge it

@slerpyyy
Copy link
Collaborator Author

bors r+

@YaelDillies YaelDillies changed the title feat(data/bool): add kaminski's equation feat(data/bool/basic): Kaminski's equation May 16, 2022
bors bot pushed a commit that referenced this pull request May 16, 2022
`bool.apply_apply_apply : ∀ (f : bool → bool) (x : bool), f (f (f x)) = f x`
@bors
Copy link

bors bot commented May 16, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/bool/basic): Kaminski's equation [Merged by Bors] - feat(data/bool/basic): Kaminski's equation May 16, 2022
@bors bors bot closed this May 16, 2022
@bors bors bot deleted the kaminski branch May 16, 2022 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions. easy < 20s of review time. See the lifecycle page for guidelines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants