[Merged by Bors] - feat(Tactic/ComputeAsymptotics/Multiseries): non-primitive corecursion for Seq#34311
Conversation
PR summary b87448799e
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Tactic | 2909 | 2922 | +13 (+0.45%) |
Import changes for all files
| Files | Import difference |
|---|---|
Mathlib.Tactic |
13 |
Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion (new file) |
1652 |
Declarations diff
+ FriendlyOperation
+ FriendlyOperation.comp
+ FriendlyOperation.const
+ FriendlyOperation.dist_le
+ FriendlyOperation.exists_fixed_point
+ FriendlyOperation.id
+ FriendlyOperation.ite
+ FriendlyOperationClass
+ FriendlyOperationClass.comp
+ Stream'.dist_le_one
+ boundedSpace
+ dist_cons_cons
+ dist_cons_cons_eq_one
+ dist_cons_nil
+ dist_eq_half_of_head
+ dist_eq_one_of_head
+ dist_eq_two_inv_pow
+ dist_nil_cons
+ exists_fixed_point_of_contractible
+ gcorec
+ gcorec_nil
+ gcorec_some
++ dist_le_one
+++ foo
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
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
SeqSeq
|
Thanks, this is very nice work! Just to check my own understanding, is the reason corecursion is useful here because:
Have I got that about right? If so this does indeed seem to be a strong case for your design. |
|
@ocfnash Thanks! Yes, we want to work with series as lazy possibly infinite lists, because we can’t know in advance how many terms we’ll need. It’s also easier to work with infinite series mathematically than with their truncations, I guess. But "basis" in the context of this tactic means something different (and it is always finite). A basis is just a list of real functions ordered by their growth rate. The main object we work with is a so-called multiseries -- a multivariate formal series with monomials of the form We need corecursion to define the operations on multiseries: addition, multiplication, etc. Some operations (multiplication and I’ve written a short description of how the tactic works to give reviewers more context: https://vasnesterov.github.io/compute_asymptotics. Feel free to ask/suggest anything. |
| /-- Metric space structure on `Stream' α` considering `α` as a discrete metric space. -/ | ||
| noncomputable local instance : MetricSpace (Stream' α) := | ||
| @PiNat.metricSpace (fun _ ↦ α) (fun _ ↦ ⊥) (fun _ ↦ discreteTopology_bot _) |
There was a problem hiding this comment.
Should this be a global instance on Stream, but with a [DiscreteTopology α] assumption?
There was a problem hiding this comment.
I don't think anything here should be global. I see this file as an ad hoc implementation of a very limited construction - just enough for the tactic.
It's possible to generalize this to arbitrary coinductive type and support a more powerful form of corecursion, but I think we need to wait until QPF is done and ready to use before doing that.
Do you think this metric space structure is useful for other applications?
| ``` | ||
| (where hd and tlArg are arbitrary functions) can be encoded via the corecursor `Seq.corec`. | ||
|
|
||
| It is not enough, however, to define multiplication and powser operation for multiseries. |
There was a problem hiding this comment.
| It is not enough, however, to define multiplication and powser operation for multiseries. | |
| It is not enough, however, to define multiplication and power operations for multiseries. |
There was a problem hiding this comment.
It's the powser operation (https://vasnesterov.github.io/compute_asymptotics#lazyseries-and-powser-operation) -- the substitution of a multiseries into a power series. This is what Eberl calls it in his tactic. But I'm happy to rename it if you have a better suggestion!
…n for `Seq` (#34311) This PR develops a theory that justifies corecursive definitions of the form ```lean def foo (x : X) := hd x :: f (foo (tlArg x)) ``` where `f : Seq α → Seq α` is a friendly operation.
|
Pull request successfully merged into master. Build succeeded: |
SeqSeq
…n for `Seq` (leanprover-community#34311) This PR develops a theory that justifies corecursive definitions of the form ```lean def foo (x : X) := hd x :: f (foo (tlArg x)) ``` where `f : Seq α → Seq α` is a friendly operation.
…n for `Seq` (leanprover-community#34311) This PR develops a theory that justifies corecursive definitions of the form ```lean def foo (x : X) := hd x :: f (foo (tlArg x)) ``` where `f : Seq α → Seq α` is a friendly operation.
…n for `Seq` (leanprover-community#34311) This PR develops a theory that justifies corecursive definitions of the form ```lean def foo (x : X) := hd x :: f (foo (tlArg x)) ``` where `f : Seq α → Seq α` is a friendly operation.
…n for `Seq` (leanprover-community#34311) This PR develops a theory that justifies corecursive definitions of the form ```lean def foo (x : X) := hd x :: f (foo (tlArg x)) ``` where `f : Seq α → Seq α` is a friendly operation.
…n for `Seq` (leanprover-community#34311) This PR develops a theory that justifies corecursive definitions of the form ```lean def foo (x : X) := hd x :: f (foo (tlArg x)) ``` where `f : Seq α → Seq α` is a friendly operation.
…n for `Seq`: `FriendlyOperation` API (leanprover-community#35072) This is a continuation of leanprover-community#34311. This PR adds more API about friendly operations: * Basic friendly operations constructions * `FriendlyOperation.destruct`: a "coinductive destructor" for `FriendlyOperation`
…n for `Seq`: `FriendlyOperation` API (leanprover-community#35072) This is a continuation of leanprover-community#34311. This PR adds more API about friendly operations: * Basic friendly operations constructions * `FriendlyOperation.destruct`: a "coinductive destructor" for `FriendlyOperation`
This PR develops a theory that justifies corecursive definitions of the form
where
f : Seq α → Seq αis a friendly operation.This is a part of the
compute_asymptoticstactic (#28291).