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

feat: Eq.ndrec lemma #385

Merged
merged 5 commits into from
Jan 15, 2024
Merged

Conversation

fgdorais
Copy link
Collaborator

Not sure about the name nor where to put this but it is definitely handy to get rid of :

example (h : n = m) (x : Fin n) : (Eq.ndrec x h).val = x.val := congr_ndrec ..

@fgdorais fgdorais added the awaiting-review This PR is ready for review; the author thinks it is ready to be merged. label Nov 23, 2023
@fgdorais
Copy link
Collaborator Author

fgdorais commented Nov 23, 2023

Hm. It doesn't pass the simp test because the lhs head symbol is a variable. Still, it sometimes works and it objectively simplifies when it does. Is this worth an exception?

I guess a more sophisticated elimination tactic that would apply this (and other) lemmas when appropriate would be better than simp here.

@digama0
Copy link
Member

digama0 commented Nov 25, 2023

Hm. It doesn't pass the simp test because the lhs head symbol is a variable. Still, it sometimes works and it objectively simplifies when it does. Is this worth an exception?

The reason these are disallowed is not because it doesn't work, but because it's a performance issue - they cannot be meaningfully indexed so they apply literally everywhere. I think there should not be an exception made here since it is a rarely used lemma.

@eric-wieser
Copy link
Member

Should this be an auto-generated congruence lemma for simp to use?

@fgdorais
Copy link
Collaborator Author

fgdorais commented Dec 7, 2023

Interesting idea. How would that work?

@fgdorais fgdorais changed the title feat: Eq.ndrec simp lemma feat: Eq.ndrec lemma Dec 20, 2023
@joehendrix joehendrix added will-merge-soon PR will be merged soon. Any concerns should be raised quickly. and removed awaiting-review This PR is ready for review; the author thinks it is ready to be merged. labels Jan 10, 2024
Copy link
Contributor

@joehendrix joehendrix left a comment

Choose a reason for hiding this comment

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

I don't have any recent experience with dependent congruence elimination, but this seems reasonable to me.

@fgdorais
Copy link
Collaborator Author

fgdorais commented Jan 10, 2024

This lemma could actually be superseded by #465. I'm not sure though. Eq has special support that I don't fully understand.

@fgdorais
Copy link
Collaborator Author

False alarm, it's not quite covered by #465.

@joehendrix joehendrix merged commit 01d1cae into leanprover-community:main Jan 15, 2024
1 check passed
digama0 pushed a commit that referenced this pull request Jan 17, 2024
* doc: extend docstrings for `ext` and `ext1` (#525)

Makes sure to mention that the patterns are processed using `rintro`, and makes sure `ext` mentions `ext1`.

* docs(Data/List): typo (#529)

* feat: Eq.rec lemma (#385)

* chore: Add empty collection instance to BinomialHeap (#532)

* Incremental Library Search (#421)

This ports library_search from Mathlib to Std.  It preserves the ability to do caching, but is designed to support a cacheless mode.  The exact and apply tactics are named `std_exact?` and `std_apply?`, but will eventually be renamed.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

* fix termination_by clauses in LazyDiscrTree

fix LibrarySearch

* bump toolchain

---------

Co-authored-by: Kyle Miller <kmill31415@gmail.com>
Co-authored-by: Martin Dvořák <martin.dvorak@matfyz.cz>
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
Co-authored-by: Joe Hendrix <joe@lean-fro.org>
semorrison added a commit that referenced this pull request Feb 1, 2024
* feat: hover info for `rcases h : ...` (#486)

* feat: hover info for `rcases h : ...`

* fix

* chore: adaptations for leanprover/lean4#3123 (#502)

* chore: adaptations for leanprover/lean4#3123

* update toolchain

* chore: remove unnecessary `have` (#516)

After leanprover/lean4#3132 the linter will complain about this.

* chore: simproc PR changes (#496)

See leanprover/lean4#3124

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

* chore: adaptions for nightly-2023-01-11 (#524)

* advance toolchain to nightly-2024-01-12, no updates required

* chore: updates to DiscrTree for changes in nightly (#536)

* doc: extend docstrings for `ext` and `ext1` (#525)

Makes sure to mention that the patterns are processed using `rintro`, and makes sure `ext` mentions `ext1`.

* docs(Data/List): typo (#529)

* feat: Eq.rec lemma (#385)

* chore: Add empty collection instance to BinomialHeap (#532)

* Incremental Library Search (#421)

This ports library_search from Mathlib to Std.  It preserves the ability to do caching, but is designed to support a cacheless mode.  The exact and apply tactics are named `std_exact?` and `std_apply?`, but will eventually be renamed.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

* fix termination_by clauses in LazyDiscrTree

fix LibrarySearch

* bump toolchain

---------

Co-authored-by: Kyle Miller <kmill31415@gmail.com>
Co-authored-by: Martin Dvořák <martin.dvorak@matfyz.cz>
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
Co-authored-by: Joe Hendrix <joe@lean-fro.org>

* feat: adaptations for leanprover/lean4#3159 (#557)

* merge origin/main

* chore: fixes for `simp` refactor (#571)

* move to v4.6.0-rc1

* fix proofs

---------

Co-authored-by: Mario Carneiro <di.gama@gmail.com>
Co-authored-by: Leonardo de Moura <leonardo@microsoft.com>
Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
Co-authored-by: Kyle Miller <kmill31415@gmail.com>
Co-authored-by: Martin Dvořák <martin.dvorak@matfyz.cz>
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
Co-authored-by: Joe Hendrix <joe@lean-fro.org>
fgdorais added a commit to fgdorais/batteries that referenced this pull request Feb 18, 2024
fgdorais added a commit to fgdorais/batteries that referenced this pull request Feb 18, 2024
)

* feat: hover info for `rcases h : ...` (leanprover-community#486)

* feat: hover info for `rcases h : ...`

* fix

* chore: adaptations for leanprover/lean4#3123 (leanprover-community#502)

* chore: adaptations for leanprover/lean4#3123

* update toolchain

* chore: remove unnecessary `have` (leanprover-community#516)

After leanprover/lean4#3132 the linter will complain about this.

* chore: simproc PR changes (leanprover-community#496)

See leanprover/lean4#3124

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

* chore: adaptions for nightly-2023-01-11 (leanprover-community#524)

* advance toolchain to nightly-2024-01-12, no updates required

* chore: updates to DiscrTree for changes in nightly (leanprover-community#536)

* doc: extend docstrings for `ext` and `ext1` (leanprover-community#525)

Makes sure to mention that the patterns are processed using `rintro`, and makes sure `ext` mentions `ext1`.

* docs(Data/List): typo (leanprover-community#529)

* feat: Eq.rec lemma (leanprover-community#385)

* chore: Add empty collection instance to BinomialHeap (leanprover-community#532)

* Incremental Library Search (leanprover-community#421)

This ports library_search from Mathlib to Std.  It preserves the ability to do caching, but is designed to support a cacheless mode.  The exact and apply tactics are named `std_exact?` and `std_apply?`, but will eventually be renamed.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

* fix termination_by clauses in LazyDiscrTree

fix LibrarySearch

* bump toolchain

---------

Co-authored-by: Kyle Miller <kmill31415@gmail.com>
Co-authored-by: Martin Dvořák <martin.dvorak@matfyz.cz>
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
Co-authored-by: Joe Hendrix <joe@lean-fro.org>

* feat: adaptations for leanprover/lean4#3159 (leanprover-community#557)

* merge origin/main

* chore: fixes for `simp` refactor (leanprover-community#571)

* move to v4.6.0-rc1

* fix proofs

---------

Co-authored-by: Mario Carneiro <di.gama@gmail.com>
Co-authored-by: Leonardo de Moura <leonardo@microsoft.com>
Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
Co-authored-by: Kyle Miller <kmill31415@gmail.com>
Co-authored-by: Martin Dvořák <martin.dvorak@matfyz.cz>
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
Co-authored-by: Joe Hendrix <joe@lean-fro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
will-merge-soon PR will be merged soon. Any concerns should be raised quickly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants