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

refactor: migrate to dependent induction lemmas #17543

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

j-loreaux
Copy link
Collaborator


Open in Gitpod

@j-loreaux j-loreaux added RFC Request for comment tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip labels Oct 8, 2024
Copy link

github-actions bot commented Oct 8, 2024

PR summary 309fd33d76

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

-- closure_induction'
--++ closure_induction
--++ closure_induction₂

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>

The doc-module for script/declarations_diff.sh contains some details about this script.

@github-actions github-actions bot added the t-algebra Algebra (groups, rings, fields, etc) label Oct 8, 2024
--induction hx using closure_induction with
--| mem z hz => induction hy using closure_induction with
--| mem _ h => exact mem _ hz _ h
--| mul _ _ _ _ h₁ h₂ => exact mul_right _ _ _ _ _ (subset_closure hz) 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.

I'm curious if you can drop the (subset_closure hz) here; I think it can be found by unification?

Comment on lines +311 to +312
(mul_left : ∀ x hx y hy z hz , p x z hx hz → p y z hy hz → p (x * y) z (mul_mem hx hy) hz)
(mul_right : ∀ x hx y hy z hz , p z x hz hx → p z y hz hy → p z (x * y) hz (mul_mem hx hy))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
(mul_left : ∀ x hx y hy z hz , p x z hx hz → p y z hy hz → p (x * y) z (mul_mem hx hy) hz)
(mul_right : ∀ x hx y hy z hz , p z x hz hx → p z y hz hy → p z (x * y) hz (mul_mem hx hy))
(mul_left : ∀ x hx y hy z hz, p x z hx hz → p y z hy hz → p (x * y) z (mul_mem hx hy) hz)
(mul_right : ∀ x hx y hy z hz, p z x hz hx → p z y hz hy → p z (x * y) hz (mul_mem hx hy))

@b-mehta
Copy link
Contributor

b-mehta commented Oct 9, 2024

It's great that we add these dependent induction lemmas, but I think it's sometimes nice to also have access to the non-dependent ones, since they're sometimes easier to work with. For example, when it's necessary to specify the motive to a dependent induction in the case where the application is not dependent, you often end up with things looking syntactically really confusing. I'd personally slightly prefer keeping the old ones around, under other names. But if it turns out that adjusting mathlib to your change is easy enough, then it's probably fine...

@eric-wieser
Copy link
Member

You should never have to specify the motive explicitly though? Usually when you do, this is because:

  • The induction principle was not dependent, and should have been
  • The induction principle has the arguments in the wrong order
  • elab_as_elim is missing from the theorem
  • You tried to use apply with an elab_as_elim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request for comment t-algebra Algebra (groups, rings, fields, etc) tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants