Comments (3)
I don't know if this applies in such low-level files, but abstractly in mathematics it's not uncommon to see a definition which relies on a theorem (if X is a perfectoid distrib then maybe there's a theorem that says there's exactly one function from X to X with some property, and then the definition of this fundamental function is that it's the unique function which the theorem says exists). I completely agree that multiset.lean is a monster, however it is laid out in a pretty logical way. Once you get going, each definition is preceded by a comment saying what we're about to and then a bunch of theorems, some end-user-friendly and some technical intermediate stuff. In this instance you might just be suggesting that these little sections all become separate files in a multiset directory. I guess this might make human-search easier (you would have multiset/powerset.lean
, multiset/countp.lean
, multiset/count.lean
and so on.
I am not sure anyone has any feeling about the amount of work which will need to be refactored anyway when Lean 4 hits. I also have no understanding (as an "end user" of theorems) how much the packaging of them matters, but let me make the slightly superficial remark that initially I found the length of multiset.lean quite scary.
from mathlib.
it's not uncommon to see a definition which relies on a theorem
Sure, that's in mathlib. I think it will depend on the particular example as to what is done with it. That is, it will probably be a judgment call. For example, the definitions of both multiset
and finset
involve theorems, but they also form the center of their own topics, with a collection of associated definitions and theorems. In other cases, there may be smaller associated collections that don't deserve forming entire hierarchies. This should fall under the Exceptions heading of the proposal.
I completely agree that multiset.lean is a monster, however it is laid out in a pretty logical way.
Sure, no argument about the arrangement.
In this instance you might just be suggesting that these little sections all become separate files in a multiset directory. I guess this might make human-search easier (you would have
multiset/powerset.lean
,multiset/countp.lean
,multiset/count.lean
and so on.
Actually, I'm not suggesting that here. I would consider that as a follow-on proposal. I have tried to frame this proposal as a small step with a noticeable improvement so that (a) it doesn't get mixed up with other possibilities and (b) it's easier to implement. Even if all of the little sections do not become separate files, I still think it's better to extract the definitions, so I see these as independent issues.
I am not sure anyone has any feeling about the amount of work which will need to be refactored anyway when Lean 4 hits.
I'm not sure of the relevance of Lean 4 here. We could be eternally waiting for something to happen without knowing what that thing is, and this would certainly slow down development. Since we don't know what to expect, I don't think waiting will do any good. And since mathlib development has continued apace, I think other people agree.
Besides, one object of this proposal is to figure out (a small part of) what makes for good Lean code organization. I don't think Lean 4 is going to change that.
from mathlib.
I think at this stage we've decided to mostly not do this, except where it resolves dependency problems. #499 above broke apart data/list/basic.lean
, so that the tactics files could depend on the definitions, and then the theorems about lists could use the tactics. If we have further instances of this problem, let's continue breaking apart files as needed.
from mathlib.
Related Issues (20)
- Refactor bilinear forms
- evaluate `int.floor` and `int.fract` with `norm_num` HOT 2
- Lean is unable to infer `ordered_smul` instance from `pi.ordered_smul'` HOT 1
- Basics of tempered distributions HOT 1
- backport remove with_cases
- backport remove `@[ext foo]`
- Diamond of complete boolean algebras on sets
- Generalize `lower_semicontinuous_supr` and variations to *conditionally* complete linear orders
- `polyrith` fails if expression is an equality of numerals
- Lean 3.49.0 compatibility HOT 6
- Q: LLM and/or an RL agent trained on mathlib and tests HOT 1
- Renaming `interval_oc` and `Ι a b` HOT 4
- `(a :: l ++ [b]).last'` does not simplify to `some b`
- mathlib/src/group_theory/presented_group.lean
- The Shapley-Folkman lemma HOT 2
- The ring of integers of a number field `K` is free of dimension `[K : ℚ]` / develop the theory of lattices HOT 3
- Tracking: attribute semireducible/irreducible
- Use a sensible sort order in multiset.repr
- Link broken HOT 1
- Proof that the unit group of a number field is finitely-generated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathlib.