Skip to content

[Merged by Bors] - feat(Data/Seq): structural lemmas#19859

Closed
vasnesterov wants to merge 18 commits intomasterfrom
vasnesterov/Seq
Closed

[Merged by Bors] - feat(Data/Seq): structural lemmas#19859
vasnesterov wants to merge 18 commits intomasterfrom
vasnesterov/Seq

Conversation

@vasnesterov
Copy link
Copy Markdown
Collaborator

@vasnesterov vasnesterov commented Dec 10, 2024

  • Add several theorems about Stream'.Seq, mainly on sequence operations with nil and cons.
  • Introduce the fold operation for sequences and prove a few structural lemmas about it.
  • Rename Seq.destruct_eq_nil as Seq.destruct_eq_none.

This PR is necessary for a new tactic (#18486), which computes the asymptotics of real functions.

Open in Gitpod

@vasnesterov vasnesterov added the t-data Data (lists, quotients, numbers, etc) label Dec 10, 2024
@github-actions github-actions bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Dec 10, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 10, 2024

PR summary 90e86dca78

Import changes exceeding 2%

% File
+18.15% Mathlib.Data.Seq.Parallel
+18.77% Mathlib.Data.Seq.Seq

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Data.Seq.Seq 277 329 +52 (+18.77%)
Mathlib.Data.Seq.Parallel 281 332 +51 (+18.15%)
Import changes for all files
Files Import difference
7 files Mathlib.Algebra.ContinuedFractions.Computation.Approximations Mathlib.Algebra.ContinuedFractions.Computation.Basic Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating Mathlib.Algebra.ContinuedFractions.Computation.TerminatesIffRat Mathlib.Algebra.ContinuedFractions.Computation.Translations Mathlib.Algebra.ContinuedFractions.ConvergentsEquiv Mathlib.Algebra.ContinuedFractions.Determinant
1
6 files Mathlib.Algebra.ContinuedFractions.Basic Mathlib.Algebra.ContinuedFractions.ContinuantsRecurrence Mathlib.Algebra.ContinuedFractions.TerminatedStable Mathlib.Algebra.ContinuedFractions.Translations Mathlib.Data.Seq.Parallel Mathlib.Data.Seq.WSeq
51
Mathlib.Data.Seq.Seq 52

Declarations diff

+ cons_eq_cons
+ cons_ne_nil
+ cons_not_terminatedAt_zero
+ cons_terminatedAt_succ_iff
+ corec_cons
+ corec_nil
+ destruct_eq_none
+ drop_get?
+ drop_nil
+ drop_succ_cons
+ fold
+ fold_cons
+ fold_head
+ fold_nil
+ get?_mem
+ get?_mem_take
+ head_eq_none
+ head_eq_none_iff
+ head_eq_some
+ length_take_le
+ nil_ne_cons
+ take_drop
+ take_nil
+ take_succ_cons
+ take_zero
+ terminates_cons_iff
+ val_eq_get
+ zipWith_cons_cons
+ zipWith_map
+ zipWith_map_left
+ zipWith_map_right
+ zipWith_nil_left
+ zipWith_nil_right
+ zip_cons_cons
+ zip_map
+ zip_map_left
+ zip_map_right
+ zip_nil_left
+ zip_nil_right
- destruct_eq_nil

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.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@vasnesterov vasnesterov added blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) and removed blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) labels Dec 10, 2024
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Dec 10, 2024
| n + 1 => tail (drop s n)

attribute [simp] drop
-- attribute [simp] drop
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the reasoning here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

When drop is marked with [simp], the simplifier unfolds (cons x s).drop (n + 1) as ((cons x s).drop n).tail instead of s.drop n, even when the drop_succ_cons simp-lemma is present. In general, I think that replacing s.drop (n + 1) with (s.drop n).tail is not what the user wants by default because it adds another sequence operation to the expression, which rarely is simplification.

With drop_nil and drop_succ_cons instead, the simplifier always simplifies the expression.

@vasnesterov vasnesterov changed the base branch from vasnesterov/Seq_lemmas to master December 17, 2024 06:56
@vasnesterov
Copy link
Copy Markdown
Collaborator Author

In #20071 I reorganized this file, so some proofs from this PR are changed. It also removes "large-import".

@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jan 22, 2025
@mathlib4-dependent-issues-bot
Copy link
Copy Markdown
Collaborator

This PR/issue depends on:

@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Feb 10, 2025
@github-actions github-actions bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Feb 12, 2025
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Feb 17, 2025
@github-actions github-actions bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Feb 17, 2025
Copy link
Copy Markdown
Member

@digama0 digama0 left a comment

Choose a reason for hiding this comment

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

bors r+

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Mar 10, 2025
mathlib-bors bot pushed a commit that referenced this pull request Mar 10, 2025
* Add several theorems about `Stream'.Seq`, mainly on sequence operations with `nil` and `cons`.  
* Introduce the `fold` operation for sequences and prove a few structural lemmas about it.
* Rename `Seq.destruct_eq_nil` as `Seq.destruct_eq_none`.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Mar 10, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Data/Seq): structural lemmas [Merged by Bors] - feat(Data/Seq): structural lemmas Mar 10, 2025
@mathlib-bors mathlib-bors bot closed this Mar 10, 2025
@mathlib-bors mathlib-bors bot deleted the vasnesterov/Seq branch March 10, 2025 10:35
tukamilano pushed a commit that referenced this pull request Mar 20, 2025
* Add several theorems about `Stream'.Seq`, mainly on sequence operations with `nil` and `cons`.  
* Introduce the `fold` operation for sequences and prove a few structural lemmas about it.
* Rename `Seq.destruct_eq_nil` as `Seq.destruct_eq_none`.
idontgetoutmuch pushed a commit to idontgetoutmuch/mathlib4 that referenced this pull request Apr 7, 2025
* Add several theorems about `Stream'.Seq`, mainly on sequence operations with `nil` and `cons`.  
* Introduce the `fold` operation for sequences and prove a few structural lemmas about it.
* Rename `Seq.destruct_eq_nil` as `Seq.destruct_eq_none`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

large-import Automatically added label for PRs with a significant increase in transitive imports ready-to-merge This PR has been sent to bors. t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants