Skip to content

[Merged by Bors] - feat(Tactic/ComputeAsymptotics/Multiseries): non-primitive corecursion for Seq: FriendlyOperation API#35072

Closed
vasnesterov wants to merge 16 commits intoleanprover-community:masterfrom
vasnesterov:compute_asymptotics_corecursion_2
Closed

[Merged by Bors] - feat(Tactic/ComputeAsymptotics/Multiseries): non-primitive corecursion for Seq: FriendlyOperation API#35072
vasnesterov wants to merge 16 commits intoleanprover-community:masterfrom
vasnesterov:compute_asymptotics_corecursion_2

Conversation

@vasnesterov
Copy link
Copy Markdown
Collaborator

@vasnesterov vasnesterov commented Feb 10, 2026

This is a continuation of #34311.

This PR adds more API about friendly operations:

  • Basic friendly operations constructions
  • FriendlyOperation.destruct: a "coinductive destructor" for FriendlyOperation

This is a part of the compute_asymptotics tactic (#28291).

Open in Gitpod

@vasnesterov vasnesterov added t-meta Tactics, attributes or user commands t-data Data (lists, quotients, numbers, etc) labels Feb 10, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 10, 2026

PR summary 507f3af613

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ FriendlyOperation.cons
+ FriendlyOperation.cons_tail
+ FriendlyOperation.destruct_apply_eq_unfold
+ FriendlyOperation.of_dist_le_pow
+ FriendlyOperation.op_cons_head_eq
+ FriendlyOperation.op_head_eq
+ FriendlyOperation.unfold
+ dist_const_tail_cons_tail_le
+ dist_le_half_iff
+ friendlyOperation_iff_dist_le_dist

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

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

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


Increase in tech debt: (relative, absolute) = (2.00, 0.00)
Current number Change Type
6901 2 backward.isDefEq.respectTransparency

Current commit 2ba6668de7
Reference commit 507f3af613

You can run this locally as

./scripts/reporting/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).

Copy link
Copy Markdown
Contributor

@joneugster joneugster left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I think the sequence of lemmas makes sense. Only a few comments

@joneugster joneugster added the awaiting-author A reviewer has asked the author a question or requested changes. label Feb 18, 2026
@vasnesterov vasnesterov removed the awaiting-author A reviewer has asked the author a question or requested changes. label Feb 22, 2026
@github-actions github-actions bot 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 22, 2026
@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 22, 2026
Copy link
Copy Markdown
Contributor

@joneugster joneugster left a comment

Choose a reason for hiding this comment

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

Thank you for the PR and the applied suggestions.

maintainer merge

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by joneugster.

@mathlib-triage mathlib-triage bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Feb 27, 2026
intro x y
specialize h (.cons hd x) (.cons hd y)
simp only [dist_cons_cons] at h
cases hx : op (.cons hd x) with
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel like the work starting here and going down is quite elementary and deserves to exist as own lemma, saying that two Seq α have distance less than 2⁻¹ iff they are either both nil or they are both cons with the same head. Something like dist_le_half_iff_nil_or_head_eq?

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.

I've added this lemma (dist_le_half_iff), but it's not clear for how to use it here.

Comment on lines +488 to +495
intro s
specialize hT s
simp only [Function.comp_apply]
generalize op s = s' at *
cases s' with
| nil =>
symm at hT
simp at hT
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see a lot of this working by cases in this file, where we specialize a lemma, do a case split, and then have to simplify the result. I wonder if we can't write a better cases / recursion principle.

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.

I'm not sure I understand. A better cases principle for Seq?

@Vierkantor Vierkantor added awaiting-author A reviewer has asked the author a question or requested changes. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Feb 28, 2026
@vasnesterov vasnesterov removed the awaiting-author A reviewer has asked the author a question or requested changes. label Mar 9, 2026
· simp [hst]
obtain ⟨n, hst⟩ := dist_eq_two_inv_pow hst
grind

Copy link
Copy Markdown
Contributor

@joneugster joneugster Mar 15, 2026

Choose a reason for hiding this comment

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

@vasnesterov to get some movement on merging your work, could I suggest that we split this PR here at this point (again)? I think everything above could be approved quite directly, while the remainder still contains some heavy, long proofs.

I doubt that a maintainer will get around looking at the entire PR, but if we split it here, I think we might improve the changes of getting some progress.

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.

Done. The second part is in #37342

@joneugster joneugster added the awaiting-author A reviewer has asked the author a question or requested changes. label Mar 15, 2026
@vasnesterov vasnesterov removed the awaiting-author A reviewer has asked the author a question or requested changes. label Mar 29, 2026
@vasnesterov vasnesterov requested a review from joneugster March 29, 2026 18:45
Copy link
Copy Markdown
Contributor

@Vierkantor Vierkantor left a comment

Choose a reason for hiding this comment

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

Thanks for the split! I think this half is good to go now.

bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Apr 2, 2026

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

@mathlib-triage mathlib-triage bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Apr 2, 2026
@vasnesterov
Copy link
Copy Markdown
Collaborator Author

bors r+

mathlib-bors bot pushed a commit that referenced this pull request Apr 2, 2026
…n for `Seq`: `FriendlyOperation` API (#35072)

This is a continuation of #34311.

This PR adds more API about friendly operations:
* Basic friendly operations constructions
* `FriendlyOperation.destruct`: a "coinductive destructor" for `FriendlyOperation`
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Apr 2, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Tactic/ComputeAsymptotics/Multiseries): non-primitive corecursion for Seq: FriendlyOperation API [Merged by Bors] - feat(Tactic/ComputeAsymptotics/Multiseries): non-primitive corecursion for Seq: FriendlyOperation API Apr 2, 2026
@mathlib-bors mathlib-bors bot closed this Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). t-data Data (lists, quotients, numbers, etc) t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants