feat: Reorganise the Mathematics directory - #1710
Conversation
|
Thank you for this pull-request (PR). If this is your first PR, welcome to the community! Below is what will happen next. Please read carefully if you are not familiar with the process. You may open other PRs while this one is being reviewed, and can stack PRs on top of each other, so don't let these steps slow you down.
Tip: The easiest way to get have a fast review is to submit a PR that is small and self-contained, and has clear documentation explaining why things are the way they are in your chages. If you have any problems or questions, please reach out to the community on the Zulip. |
|
claim |
|
Review claim by @nateabr completed — thanks for the review. |
nateabr
left a comment
There was a problem hiding this comment.
Looks good to me - approved :)
|
A point for clarification before this merges, have you also imposed that all files in |
|
No, files in ./Physlib/Mathematics need not be used outside that directory, only those in ./Physlib/Mathematics/ForMathlib. The idea here is to stop people adding things which are really for mathlib to Physlib. |
1433e0d
Made with the help of Opus 5.5.
Split ./Mathematics into ./Mathematics and ./Mathematics/ForMathlib. The latter is for results for Mathlib, whilst everything else in ./Mathematics is mathematics for physics.
AI summary
refactor(Mathematics): split out
ForMathlib/, addforMathlib_lintPhyslib/Mathematics/currently mixes two kinds of file:This PR moves the second kind into
Physlib/Mathematics/ForMathlib/and adds a linter that keeps that directory upstreamable.1. Reorganisation
These are file moves only: no declaration is renamed. Only import paths and module references in docstrings change.
ForMathlib/:Trigonometry/,OneParameterSubgroups/,DataStructures/Matrix/LieTraceFin.leanandFin/,List.leanandList/LinearMaps,LinearPMap,OrthogonalMatrix,SchurTriangulation,FDerivCurry,HasTemperateGrowthModules/:ConjModule,CrossProduct,CrossProductMatrixGroups/SO3/:SO3/Basic2. New linter:
lake exe forMathlib_lintThe linter is in
scripts/forMathlib_lint.lean. It only parses import headers, so it does not need a build. It checks two rules:ForMathlib/may import only fromForMathlib/, Mathlib, Batteries and Lean. It may not import anything else fromPhyslib,PhyslibAlphaorQuantumInfo.ForMathlib/must be imported, directly or through otherForMathlib/files, by some file outsideForMathlib/. The library root files don't count as uses.It is wired into
lakefile.toml,lint_all, CI (build.yml) and theAGENTS.mdchecklist.Definitions added (all in
scripts/forMathlib_lint.lean):forMathlibPrefix,libraryDirs,isForMathlib,isLibraryModule,moduleNameOfPath,libraryImports,outsideImports,unusedModules,sortNames,main.3. Changes needed to pass the linter
ForMathlib/LinearMaps: itsTODOnote moved to the TODO section ofQFT/AnomalyCancellation/Basic, its only user. This removes thePhyslib.Meta.TODO.Basicimport fromLinearMaps.DataStructures/FourTree/Basic:Leaf,Twig,Branch,Trunk,FourTree,fromMultiset,toMultiset,{Twig,Branch,Trunk}.card,card,card_eq_toMultiset_card,{Leaf,Twig,Branch,Trunk}.mem,mem,mem_iff_mem_toMultiset,mem_of_partsDataStructures/FourTree/UniqueMap:{Leaf,Twig,Branch,Trunk}.uniqueMap4,uniqueMap4,{Twig,Branch,Trunk}.uniqueMap3,uniqueMap3,map_mem_uniqueMap{3,4},exists_of_mem_uniqueMap{3,4}Geometry/Metric/PseudoRiemannian/Defs:PseudoRiemannianMetric,negDim,pseudoRiemannianMetricValToQuadraticForm,toBilinForm,toQuadraticForm,innerflat,flatL,flatEquiv,sharp,sharpL,sharpEquivcotangentMetricVal,cotangentToBilinForm,cotangentToQuadraticForm*_apply,*_isSymm,*_nondegenerate,flat_inj,flatL_surj,flat_sharp_apply,sharp_flat_apply,apply_sharp_sharp,apply_vec_sharp,rankNeg_eq_zero,posDef_no_neg_weights,neg_weight_implies_neg_value,QuadraticMap.weightedSumSquares_basis_vectorGeometry/Metric/Riemannian/Defs:RiemannianMetric,tangentInnerCore,TangentSpace.metricNormedAddCommGroup,TangentSpace.metricInnerProductSpace('),norm,norm',curveLength,pos_def,toQuadraticForm_posDef,riemannian_metric_negDim_zero,norm_eq_norm_of_metricNormedAddCommGroup. Mathlib now providesBundle.RiemannianMetric.PiTensorProduct:induction_tmul,induction_assoc('),induction_tmul_mod,induction_mod_tmul,pureInl,pureInrand theirupdatelemmas,domCoprod,tmulSymm,elimPureTensor(and itsupdatelemmas),elimPureTensorMulLin,tmul,tmulEquiv,tmulEquiv_tmul_tprodResolvent:mem_resolventSet_of_im_ne_zero,resolventSet_eq_univ,norm_resolvent_le,contDiff_resolvent,iteratedDeriv_resolvent,norm_iteratedDeriv_resolvent_le,hasTemperateGrowth_resolventMeta/Linters/DefsWithUnderscore: a comment no longer refers to the deletedFourTreefile. The exemption it describes is unchanged.Reviewer map
scripts/forMathlib_lint.lean, then the one-line wirings inlakefile.toml,scripts/lint_all.lean,.github/workflows/build.ymlandAGENTS.md.LinearMaps→AnomalyCancellation/BasicTODO move.🤖 Generated with Claude Code