Skip to content

AlgebraicFramework: Jordan/JB/JBW hierarchy, Stinespring dilation, trace-class infrastructure - #3

Closed
TomOleDiem wants to merge 81 commits into
masterfrom
pr/algebraic-framework-pack
Closed

TomOleDiem wants to merge 81 commits into
masterfrom
pr/algebraic-framework-pack

Conversation

@TomOleDiem

Copy link
Copy Markdown
Owner

Summary

Extends AlgebraicFramework with the Jordan-algebraic order-unit hierarchy (Jordan/JB/JBW), and
closes several gaps identified against external Lean libraries (adambornemann-glitch/Spectra,
Cobord/JordanAlgebra, and a sibling unbounded-alpha-public branch), while keeping the abstract
Jordan/JB/JBW layers independent of any concrete C*-algebra/Hilbert-space realization.

What's in this PR

  • JordanOrderUnit/: quadratic representation, Jordan triple product, inner derivations and
    the structure-algebra toolkit (D_{a,b}, V_{a,b}), proving the fundamental formula for
    quadratic representations U(U a b) = U a * U b * U a (quadRep_fundamental) via the
    triple-operator commutator identity. JB/ and JBW/ layers (generated-by-one continuous
    functional calculus, square-root uniqueness, spectrum, projection resolutions), Power/,
    Quadratic/, and an Examples/SpinFactor instance.
  • Algebra/: Alternative, NuclearInvolution, Derivation, Statistics — bare algebraic
    notions factored out independent of Jordan order, norms, or dynamics.
  • Dynamics/: OneParameterGroup, Generator, and the bridge theorem that a one-parameter
    automorphism group's generator is a derivation.
  • CStarAlgebra/: Jordan, JordanCFC, JordanCompatibility, JordanPositivity,
    JordanSpecial, JordanStatistics — the concrete realization discharging the abstract Jordan
    capabilities.
  • CStarAlgebra/Stinespring/: Stinespring's dilation theorem for completely positive maps
    into B(H) — the general framework Naimark's theorem is a special case of.
  • HilbertSpace/TraceClass/: Hilbert–Schmidt operators, polar decomposition, and the general
    product/ideal-norm theory needed for a genuine trace-class Banach space — closing a prerequisite
    gap that was entirely absent from Mathlib.
  • HilbertSpace/Unbounded/EssentialSpectrum/: essential spectrum and Weyl's theorem on its
    invariance under relatively compact perturbation.
  • OrderUnit/, Measurement/, StarAlgebra/, Representation/: assorted extensions
    (monotone completeness, weight/state equivalence and separation, bounded scalarization,
    probability law, discrete Naimark dilation) supporting the above.

EXTERNAL_INTEGRATION_PLAN.md records the full investigation of the three external sources: what
was ported, what was independently reproduced and kept instead, and what remains open (Tomita–
Takesaki modular theory; a remaining trace-class density theorem needed for
WStarAlgebra(B(H))'s predual).

Verification

  • lake build PhyslibAlpha: clean, 9028 jobs, 0 errors.
  • lake exe sorry_lint: passes.
  • git ls-files 'PhyslibAlpha/*.lean' | xargs ./scripts/lint-style.py: 0 errors.
  • rg '\b(sorry|admit)\b': no matches in any new/changed executable Lean code (only prose mentions
    in comments/roadmap docs, e.g. "0 sorry", "not even as a sorry'd restatement").
  • No abstract JordanOrderUnit file imports CStarAlgebra/HilbertSpace (verified by grep),
    preserving the architectural rule that the abstract layers never depend on a concrete
    realization.

Scope notes

  • A few files that came out of the same development pass are excluded because they are not
    yet sorry-free or not yet buildable, per house convention (unwired from PhyslibAlpha.lean
    until they are): WStarAlgebra/HilbertSpaceInstance.lean (3 remaining sorries, gated on a
    rankOneSpan_dense density theorem), and a small quantum-mechanics QuadraticSystem/Stone–von
    Neumann tree that is out of scope for this PR (kept locally, not included here).
  • OrderUnit/State/WeightBridge.lean is renamed to WeightEquivalence.lean (extended, not
    deleted) — see the diff.

🤖 Generated with Claude Code

catlover-bot and others added 30 commits August 11, 2026 16:44
…unity#1507)

* refactor(QED): name even anomaly-cancellation planes

* refactor(QED): update mixed-plane lemma names

* style(QED): wrap renamed mixed-plane lemmas

---------

Co-authored-by: catlover-bot <catlover-bot@users.noreply.github.com>
leanprover-community#1509)

* feat(QuantumMechanics/Hydrogen): prove angularMomentum_commutation_lrl

Closes the `@[sorryful]` gap on `HydrogenAtom.angularMomentum_commutation_lrl`
(`⁅𝐋ᵢⱼ, 𝐀(ε)ₖ⁆ = iℏ(δᵢₖ𝐀(ε)ⱼ - δⱼₖ𝐀(ε)ᵢ)`, the statement that the regularized
Laplace-Runge-Lenz vector transforms as a vector under rotations), using only
already-proved companion commutators from `Operators/Commutation.lean`
(`angularMomentum_commutation_angularMomentum`, `_momentum`, `_radiusRegPow`,
`_position`) and `lrlOperator_eq'`'s expanded form of `𝐀(ε)ᵢ`.

Adds one private helper, `angularMomentum_commutation_Ldot_p`, for how `𝐋ᵢⱼ`
commutes with the `𝐋ₖ⬝ᵥ𝐩` term in that expansion.

`angularMomentum_commutation_lrlSqr` and `angularMomentumSqr_commutation_lrlSqr`
were already fully proved modulo this one dependency, so their `@[sorryful]`
tags come off too -- `#print axioms` on all three now shows only
`propext`/`Classical.choice`/`Quot.sound`, matching `sorryfulPseudoTest`'s
"tagged sorryful iff it actually contains sorryAx" invariant.

* Remove unneeded 'private' from angularMomentum_commutation_Ldot_p

Addresses review feedback on leanprover-community#1509 (jstoobysmith).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…y#1498)

Co-authored-by: OpenAI GPT-5.6 Pro <noreply@openai.com>
* docs(quantum-info): add qubit API map (addresses leanprover-community#850)

* docs(quantum-info): move qubit map to Physlib/QuantumMechanics/Qubit and split out the finite dimensional mixed-state content
…nprover-community#1512)

* HS api map

* parent api

* move file

* remove parent

* narrow focus to tensor products

* sp fix

* fix locations

* fix import order
…r-community#1517)

Co-authored-by: catlover-bot <catlover-bot@users.noreply.github.com>
…pace 1` (leanprover-community#1518)

* remove unnecessary temperate growth lemmas

* refactor hbar

* refactor Schwartz operators

* define unbounded operators

* add sections

* flesh out sections

* rename file

* update docs

* add TODOs

* var clean up
* feat(SpaceAndTime): add reference frames

* refactor(SpaceAndTime): use TODO command and close namespaces in ReferenceFrame

* docs(SpaceAndTime): describe ReferenceFrame.Vector as a general coordinate carrier
…1515)

* docs(operators): add quantum operators API map

* docs(operators): split spectral theory into its own API map

Address review feedback: one requirement per concept in the repository's
one-sentence style, spectral theory moved to its own map alongside the
SpectralTheory source directory, and the OneDimension entry dropped since
those modules are slated for removal.
…prover-community#1520)

* d-dim posn states

* d-dim momentum states

* add to posn docs

* add to momentum docs

* add eigenvector TODOs

* notes in 1d files

* fix imports
* chore: adapt to Lean v4.33.0 / Mathlib v4.33.0

Proof repairs where the NNReal mk-coercion goals no longer reduce for
rw/simp matching under the module system: restate at the real carrier
via show (definitional through the exposed Inv/Div instances) and close
with inv_div / div_mul_div_comm / push_cast + norm_num; append the
proof-irrelevant rfl the simp normal form now leaves. Replace the
derived Fintype instance on LTMCTDimensionBase (the derive handler
produces an ill-typed Finset under v4.33) with an explicit instance.

* chore: adapt to Lean v4.33.0 — dimension-scale and Fintype layer

Add the ℝ≥0-level unit-ratio cocycle div_mul_div to each unit module and
close dimScale_transitive with it (the coercion-level simp set no longer
reaches through the rpow products); Dimensionful.ext via Subtype.ext;
replace the derived Fintype on ISQDimensionBase with an explicit instance
(same derive-handler rot as LTMCTDimensionBase).

* chore: adapt to Lean v4.33.0 — full library

Bump mathlib and doc-gen4 to v4.33.0, regenerate lake-manifest.json,
update the README Lean badge.

Repair the whole-library proof rot from Lean v4.33's transparency-
respecting isDefEq: rw/simp/rfl no longer match through semireducible
def synonyms (Charges, Space/SpaceTime, tensor carriers, HermitianMat,
WickContraction/WickAlgebra quotients, ...). The dominant, established
remedy is the per-declaration compatibility option
set_option backward.isDefEq.respectTransparency false (already used at
30+ sites pre-bump and by mathlib's own mfderiv proofs); proofs are kept
verbatim wherever it suffices. The rest is mathlib drift: setOf →
Set.ofPred (explicit proofs where grind/tauto derailed), zpow_ofNat and
chartAt_self_eq simp-set changes, Set.restrict → Set.domRestrict,
Equiv.apply_eq_iff_eq_symm_apply → Equiv.eq_symm_apply, argument rename
in IsCobounded.of_frequently_le, deriving Fintype rot on enums, and the
local Matrix.IsUpperTriangular abbrev now subsumed by mathlib's.

Also fix deprecation and unused-simp-arg warnings, and drop the three
genuinely redundant direct imports the transitive-import linter flags
that stay green under the module system.

* chore: adapt PhyslibAlpha to Lean v4.33.0

Fix the QuantumMechanics proofs that broke under v4.33's stricter
transparency handling (rewrites/simp no longer see through `Matrix`
applied as a bare function after unfolding):

- QuantumHarmonicOscillator: replace a rotted `simp` nonnegativity
  closer with an explicit term, and redo the `coherentState_ℓ2`
  membership proof via `HasSum.mul_left` instead of norm-splitting
  simp lemmas that no longer fire.
- StinespringDilation: move `stinespringOp_apply` up next to
  `stinespringOp` and use it so proofs rewrite entries directly
  instead of unfolding `stinespringOp` into a raw lambda; rebuild
  `tracefree_version`, `unitaryForm_of_general(_e)` (via
  `dilation K z (Ud hK z) = Ud hK z`), `stinespringGeneralForm_works`,
  and `stinespringForm_eq` on that basis.

Also clear all build warnings (unused simp arguments, deprecated
`Set.mem_setOf_eq` / `ContinuousMultilinearMap.*_apply`, `haveI`
suggestions) in PhyslibAlpha.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* Add LadderSystem and HarmonicOscillator experimental modules to PhyslibAlpha (work-in-progress)

* Fix line-length lint error in HarmonicOscillator/Basic.lean

Remove stray leftover word ('public') from the overview doc-comment
that pushed line 18 past the 100-character limit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: jstoobysmith <72603918+jstoobysmith@users.noreply.github.com>
…nprover-community#1524)

* Add Pauli vector identities and self-adjoint decomposition

A few useful identities about Pauli matrices, needed to prove things
about qubits later on.

- The matrix `a · σ` for a real 3-vector `a`
- The Pauli anticommutation relation `{σᵢ, σⱼ} = 2 δᵢⱼ I`
- The anticommutator and commutator of two such vector-matrices, in
  terms of the dot product and cross product of the underlying vectors
- The product formula `(a · σ)(b · σ) = (a · b) I + i (a × b) · σ`
- The scalar/vector split of a self-adjoint 2×2 matrix's Pauli
  decomposition, the radius of its vector part, and the identity
  that squaring the vector part gives that radius squared times the
  identity matrix

The general trace-orthogonality identity added above (`tr(σ_μ σ_ν) =
2 δ_μν`) subsumes three existing special-case `@[simp]` lemmas, so
those lose the attribute in favour of the general one; two other
lemmas that leaned on them via `trace_mul_comm` are made
self-contained instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(Relativity): unfold kroneckerDelta in Pauli linear-independence proofs

The closing simpa [pauliMatrix] using h1 in both
pauliSelfAdjoint_linearly_independent and
pauliSelfAdjoint'_linearly_independent left mismatched-index
kroneckerDelta terms (e.g. δ[Sum.inl 0, Sum.inr 0]) unevaluated,
since kroneckerDelta was never added to the simp set that closes the
goal. Add it so those terms actually reduce to 0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Address review on Pauli vector identities and self-adjoint decomposition

- Move pauliMatrix_anticommutator above vectorMatrix (doesn't depend on it)
- Tighten the multi-line have-blocks in vectorMatrix_anticommutator,
  vectorMatrix_commutator and vectorMatrix_mul_vectorMatrix to take less
  vertical space
- Merge back-to-back simp only calls in vectorMatrix_commutator's proof
  (and vectorMatrix_anticommutator's, for consistency)
- Rename scalarPart -> scalarCoeff to match vectorCoeff/pauliCoeff naming
  (it's a real number, not an algebra element like vectorPart)
- Move pauliRadius_sq and pauliRadius_nonneg up next to the pauliRadius
  definition
- Move vectorMatrix_sq out of SelfAdjoint.lean into Basic.lean, since it's
  purely a vectorMatrix identity and doesn't involve self-adjointness

lake build on both files passes clean (no sorry, no warnings).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: jstoobysmith <72603918+jstoobysmith@users.noreply.github.com>
* Add PR size labeling workflow

Labels PRs green-small (<100 lines), orange-medium (100-499), or
red-large (500+), based on total additions + deletions.

* Rename size labels to small/medium/large

Keep the green/orange/red colors, just drop the color from the label name.
)

* docs(units): add units and dimensions API map

* docs(units): one requirement per concept in the units API map

Address review feedback: split the fifteen bundled entries into
sixty-seven single-sentence requirements in the repository's style, and
trim the overview. No declaration was added or removed.

* docs(units): name the LTMCT set instead of calling it the default

The map described LTMCTDimensionBase as "the default" basis in eight
places. Nothing in the API defaults to it: Dimension is parameterised
over B with no optParam and no default instance, so every use site
writes its basis. Name the two sets instead of ranking them, and record
LTMCT's actual role -- the typed unit layer and the named derived
quantities are built over it, while the ISQ set carries SIUnitChoices.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8P8QaGsVJnpDV7eRgaiKK

* docs(units): spell out the LTMCT and ISQ acronyms at first use

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
…rover-community#1510)

* Add Stone's theorem, finite-dimensional form (Hermitian <-> unitary one-parameter groups)

Physlib/Mathematics/OneParameterSubgroups/Basic.lean (new):
- OneParameterSubgroup.existsUnique_generator: every continuous one-parameter subgroup of a
  real Banach algebra's unit group is exp(t . A) for a unique generator A. Pure Banach-algebra
  content, no physics, reusable well beyond quantum mechanics.

Physlib/Mathematics/OneParameterSubgroups/Matrix.lean (new):
- Specializes the above to complex matrices via the Frobenius norm, identifying real scalar
  multiplication with multiplication by real complex numbers.

Physlib/QuantumMechanics/Stone.lean (new):
- Matrix.UnitaryOneParameterSubgroup and the finite-dimensional Stone correspondence: a
  continuous one-parameter subgroup of U(n) has a unique anti-Hermitian generator A
  (equivalently, after multiplying by i, a unique Hermitian generator H with
  U(t) = exp(-itH)) -- existsUnique_antiHermitian_generator / existsUnique_hermitian_generator.
- The converse direction, ofHermitian: every Hermitian H genuinely generates a continuous
  U(n)-valued one-parameter subgroup t -> exp(-itH), bundled as a real ContinuousMonoidHom
  (built via MonoidHom.codRestrict + Continuous.subtype_mk, sidestepping Mathlib's lack of a
  canonical matrix norm by routing the exp-additivity/continuity proofs through
  Matrix.exp_add_of_commute's own `open scoped Norms.Operator` pattern rather than the
  ambient default instance).
- stoneEquiv: the finite-dimensional statement of Stone's theorem itself, as a genuine
  Equiv between U(n)'s continuous one-parameter subgroups and the Hermitian n x n matrices --
  the algebraic reason a Hermitian Hamiltonian generates unitary time evolution, specialized
  to finite-level (e.g. qubit) quantum systems.

All new theorems kernel-checked (#print axioms): only propext, Classical.choice, Quot.sound.
Zero sorry.

* Clean up for PR: drop private, fix stale doc reference, dedupe ℚ-algebra instance

- Basic.lean: the module doc referenced a now-deleted Unitary.lean; point it at
  Physlib.QuantumMechanics.Stone instead. Drop private from all 8 internal
  lemmas (ambientValue and friends) -- physlib's module system makes private
  declarations brittle, and there's no reason these helper lemmas need to be
  hidden. Hoist the NormedAlgebra ℚ E instance (needed for NormedSpace.exp's
  API) to a single local instance declared once, instead of duplicating the
  same 'let +nondep' inline in both exists_generator_of_nontrivial and
  existsUnique_generator.
- Stone.lean: add a reference to Stone's original 1932 theorem.

Re-verified: targeted build of all 3 files, full Physlib aggregate build,
#print axioms on the 6 key public theorems (only propext/Classical.choice/
Quot.sound), and empty sorry/private greps -- all clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix Stone theorem lint failures

Document the helper definitions and remove the unused Fintype assumption from Matrix.IsAntiHermitian.

Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>

* Address initial Stone theorem review

Use lemma declarations throughout and remove imports reported as redundant by Mathlib's import analysis.

Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>

* Frame finite-dimensional Stone theorem as time evolution

Use the physical exp(-itH/ℏ) normalization, connect the result to FiniteTarget time evolution, and explain its scope relative to unbounded QuantumSystem Hamiltonians.

Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>

* Simplify Stone theorem key results

Present only the physically normalized Hamiltonian statement in the module overview.

Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>

* Expose only the physical Stone generator result

Fold the anti-Hermitian and natural-units existence arguments into existsUnique_hamiltonian so the public API has one generator theorem normalized by ℏ.

Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>

* Keep Stone API in Hamiltonian normalization

Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>

* Integrate Stone theorem with bounded time evolution

Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>

* Refine unitary time evolution API

* Generalize Stone correspondence to unitary one-parameter groups

* Fix Stone correspondence simp normalization

* Reply to PR: update OneParameterSubgroups

* Address review round: merge duplicate generator uniqueness lemma, extract stoneEquiv simp lemmas

- Remove deriv_unique, keep generator_unique (.generator-phrased);
  inline OneParameterSubgroup.generator_unique at both call sites.
- Extract ofSelfAdjoint_generator and generator_ofSelfAdjoint as
  standalone @[simp] lemmas from stoneEquiv's left_inv/right_inv.
- Rename generator_selfAdjoint -> generator_isSelfAdjoint.
- Fix placeholder docstring on mem_unitary; drop unneeded
  simpa/have in apply_eq_exp_deriv and adjoint_deriv_eq_neg.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Address review round: streamline adjoint_deriv_eq_neg, restructure
ofSelfAdjoint into a single constructor literal, drop redundant congr
in ofSelfAdjoint_apply

Resolves gloges's three outstanding suggestions from 2026-08-16.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.8 <no-reply+claude-opus-4-8@anthropic.com>
)

* updated workflow to use lean target instead of python script

* changed AGENTS.md to instruct agents to run lean target instead of python script2

* added function to get all filepaths in given directory

* added noAlphaImports build target to lakefile

* created noAlphaImports file

---------

Co-authored-by: FergusMunro <fmunro07@gmail.com>
* init eigenstates

* add ξEquiv

* eigenfunctions

* eigenstates

* move/add TODOs

* move HasTemperateGrowth.prod

* move coord hasTemperateGrowth

* add to docs

* add note

* fix stray sqrt

* ξEquiv simp lemmas

* move eigenvalues

* coeff → eigenCoeff

* DecidableEq → classical

---------

Co-authored-by: jstoobysmith <72603918+jstoobysmith@users.noreply.github.com>
…ng (leanprover-community#1549)

Correct typo in doc comment heading (TimeOrder.lean:291):
'FiedOpAlgebra' -> 'FieldOpFreeAlgebra'

The section documents time order for the FieldOpFreeAlgebra type.
* feat(Relativity): add evalT_evalT

Co-authored-by: ChatGPT <noreply@openai.com>

* refactor(Relativity): simplify evalT_evalT basis proof

Co-authored-by: ChatGPT <noreply@openai.com>

---------

Co-authored-by: catlover-bot <catlover-bot@users.noreply.github.com>
Co-authored-by: ChatGPT <noreply@openai.com>
* feat(PauliMatrices): add covariant Pauli trace orthogonality

* feat(SL2C): express toLorentzGroup entries using traces

* feat(PauliMatrices): express covariant Pauli traces using matrix entries

* feat(LorentzGroup): add SL2C lifts of coordinate-axis boosts

* chore(LorentzGroup): some clean up and adding import

* docs(LorentzGroup): update axis boost authors

* refactor(Relativity): index coordinate-axis boosts

* refactor axis boosts using coordinate rotations

* document coordinate-axis rotations

* split axis rotation lemmas by coordinate

* inline axis rotation normalization proofs

* split axis boost lemmas by coordinate

* rename Lorentz trace pairing indices

* group axis boost SL2C results
…-community#1548)

* feat(Relativity): add pointwise succSuccAbove commutation

Co-authored-by: ChatGPT <noreply@openai.com>

* style(Relativity): compact succSuccAbove commutation lemma

Co-authored-by: ChatGPT <noreply@openai.com>

---------

Co-authored-by: catlover-bot <catlover-bot@users.noreply.github.com>
Co-authored-by: ChatGPT <noreply@openai.com>
…#1551)

Co-authored-by: catlover-bot <catlover-bot@users.noreply.github.com>
Co-authored-by: ChatGPT <noreply@openai.com>
…1553)

* docs(reference-frame): add reference frame API map

* docs(reference-frame): correct the affine framing, drop the non-dependency parent, sharpen the frame conditions
…prover-community#1550)

* feat(OperatorAlgebra): start the operator algebra formalization

Starts the operator-algebra formalization.

This file introduces no new mathematics — it only renames existing objects
to the names physicists actually use for them: `Observable`, `Effect`,
`POVM`, `Unitary`, `State`, `Channel`, `Representation`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(OperatorAlgebra): silence unusedArguments lint on PositiveElement, Effect

CI's Lean style linters flagged [StarOrderedRing A] as unused in both
abbrevs' types. It's kept for the mathematical meaning (it makes `≤`
the C⋆-algebra order), so mark them nolint instead of dropping it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* refactor: move OperatorAlgebra from Mathematics to QuantumMechanics

Physlib/Mathematics/OperatorAlgebra/Basic.lean ->
Physlib/QuantumMechanics/OperatorAlgebra/Basic.lean.

States/observables/effects/channels are quantum-mechanics content, not
domain-agnostic math scaffolding, so they belong under QuantumMechanics/
alongside Operators/ and Qubit/ rather than under Mathematics/. Pure
move, no content changes; Physlib.lean's import updated and
re-alphabetized. Local commit only, not pushed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* feat(OperatorAlgebra): address review comments on Basic.lean

- Bundle CStarAlgebra + PartialOrder + StarOrderedRing into a new
  `OperatorAlgebra` class, taken by every positivity-dependent notion
  (PositiveElement, Effect, POVM, State, Channel). Observable and
  Representation need only the star structure, so they keep the bare
  CStarAlgebra hypothesis. This also removes the two
  @[nolint unusedArguments]: bundled, StarOrderedRing's data (`<=`) is
  visibly used, so the linter has nothing to flag.
- Module doc: say what the paradigm algebra is for quantum (B(H),
  unitary evolution) and classical (C(M), commuting functions on phase
  space) systems.
- Add a line to each notion explaining what it's for physically, not
  just what it is (Observable, PositiveElement, POVM, Unitary, State).
- Unify docstring style across the file: single `/-- ... -/` block,
  no blank-separated paragraphs, closing delimiter inline.

Third review comment (Observable's eventual move to its own
Observable.lean) intentionally left open; being answered separately.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* style(OperatorAlgebra): collapse double blank lines to single

lake exe lint_all flags "Double empty line" - the file had consecutive
blank lines between every declaration throughout (pre-existing from
before this PR's changes, never previously caught). Collapsed to a
single blank line between declarations, matching physlib style.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* style(OperatorAlgebra): collapse typeclass args onto one line

Per jstoobysmith's review: the multi-line argument/variable lists in
Observable, PositiveElement, Effect, POVM, Unitary, State, Channel,
and Representation (plus the Representation section's `variable`
block) fit on one line and don't need to be wrapped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* docs(temperature): add temperature API map

* docs(temperature): correct the parent API, the recorded limit, and the differentiability statement
…unity#1552)

* created alphaFileImports.lean

* updated lakefile and agents.md to include alphaFileImports as build target

* included alphaFileImports and noAlphaImports in lint_all.lean

* changed alphaBuild workflow to use new lean script

* modified lean checkers to allow for command line arguments

* created Meta/test directory, populated with dummy project violating linter rules, and created testing lean script2

* added testImportScript to lakefile

* added text for new checks in lint_all

* temporarily removed Meta file

* Removed newlines and accidental test case.

* removed a few extra newlines

---------

Co-authored-by: FergusMunro <fmunro07@gmail.com>
…eanprover-community#1560)

* feat(Mathematics): gradient_add_const, gradient_const_mul, gradient_inner_self, gradient_coord

Add `Physlib/Mathematics/Calculus/Gradient.lean` with the elementary gradient rules on a real
Hilbert space: `gradient_add_const`, `gradient_const_mul`, `gradient_inner_self`,
`gradient_const_mul_inner_self`, and `gradient_coord` for coordinate functionals on
`EuclideanSpace ℝ ι`. These are the lemmas that the harmonic oscillator and damped harmonic
oscillator currently prove privately and that the simple pendulum needs as well.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* refactor(ClassicalMechanics): use shared gradient lemmas in HarmonicOscillator.Basic

Replace the local `gradient_inner_self`, `gradient_const_mul_inner_self` and the private
`gradient_add_const'` of the harmonic oscillator by the general lemmas of
`Physlib.Mathematics.Calculus.Gradient`. No statement about the harmonic oscillator changes.

Also remove `toDual_symm_innerSL`: it was a helper for the deleted gradient lemmas and has
no remaining use anywhere in the repository.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* refactor(ClassicalMechanics): use shared gradient_const_mul in DampedHarmonicOscillator.Basic

Drop the private copy of `gradient_const_mul` in favour of the general lemma in
`Physlib.Mathematics.Calculus.Gradient`.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* docs(Mathematics): docstrings and scope notes for the shared gradient lemmas

Add one-line docstrings to `gradient_add_const`, `gradient_const_mul`, `gradient_inner_self`,
`gradient_const_mul_inner_self` and `gradient_coord`; explain in the module overview how this
file relates to `Space.Derivatives.Grad` and why it is stated over `ℝ`; drop the redundant
import of `Mathlib.Analysis.InnerProductSpace.PiL2`.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* feat(Mathematics): gradient_comp_coord, the chain rule for a function of one coordinate

Add `gradient_comp_coord : HasDerivAt f f' (x i) → gradient (fun y => f (y i)) x =
f' • EuclideanSpace.single i 1`, the general form of the cosine-potential gradient that the
simple pendulum needs.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
jstoobysmith and others added 27 commits September 1, 2026 05:12
Add more structured table to the readme, showing the Lean ecosystem.
… amplitude-dependent period (leanprover-community#1576)

* feat(ClassicalMechanics): SimplePendulum.periodFormula, its small-angle limit, continuity and monotonicity in the amplitude

- periodFormula θ₀ := 4 √(ℓ/g) completeEllipticK (sin² (θ₀/2)), the classical formula of
  Landau–Lifshitz §11 Problem 1 in the parameter convention, with a TODO listing the
  milestones toward identifying it with the period of the motion released from rest
  (uniqueness and time reversal are formalized in a companion module, contributed
  separately)
- periodFormula_neg (evenness); periodFormula_zero = smallAnglePeriod (@[simp])
- continuousOn_periodFormula on (-π, π), continuousAt_periodFormula_zero, and the
  small-angle limit periodFormula_tendsto_smallAnglePeriod
- periodFormula_mono / periodFormula_strictMono on 0 ≤ θ₁ ≤ θ₂ < π and their bundled forms
  monotoneOn_periodFormula / strictMonoOn_periodFormula on Set.Ico 0 π
- the sandwich smallAnglePeriod_le_periodFormula ≤ … ≤ periodFormula_le / periodFormula_le'
  (smallAnglePeriod / cos (θ₀/2)), and periodFormula_pos
- API-map rows: the formula (done) and the period theorem (done: false); Physlib.lean import

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Codex GPT-5.6 <noreply@openai.com>

* docs(ClassicalMechanics): timeless phrasing for the period-formula module doc

Drop the references to contribution mechanics ("not part of this contribution", "contributed
separately") in favor of naming the companion module `SimplePendulum/Solution.lean` directly.

Requested by review on leanprover-community#1576.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Homi <322615700+Homi@users.noreply.github.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Homi <322615700+Homi@users.noreply.github.com>
Same fix as leanprover-community#1586 did for the linter workflows. The shallow clone means
lake only has one commit to look at so the restore never finds anything
and every merge rebuilds from scratch.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
…ions (leanprover-community#1599)

Discharge the relocation TODO in RigidBody/Basic.lean: the test-function
constructor `cmap` and its evaluation lemma `cmap_apply` move unchanged
from the rigid-body file to the new general file
Physlib/SpaceAndTime/Space/SmoothFunctions.lean, under the `Space`
namespace. The rigid-body files borrow the two names with a selective
`open Space (cmap cmap_apply)`, so every statement and proof is
untouched.


Claude-Session: https://claude.ai/code/session_01FMFfQktaC5pFD1JyETTU4i

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…rover-community#1592)

* feat:  time derivative of trajectories into torsors as derivVec

* name
…simple pendulum (leanprover-community#1575)

* feat(ClassicalMechanics): SimplePendulum.equationOfMotion_unique

- phaseVectorField (θ, θ̇) ↦ (θ̇, -ω² sin θ · e₀) on the phase space, with its global
  Lipschitz bound phaseVectorField_lipschitz (sin is 1-Lipschitz)
- acceleration_eq_of_equationOfMotion: the equation of motion read as the second
  derivative in closed form
- phaseCurve_hasDerivAt: a smooth solution's phase curve is an integral curve of the
  field, via Time.hasDerivAt_comp_toRealCLE_symm
- equationOfMotion_unique via ODE_solution_unique_univ, and the IsSolution packaging
  IsSolution.eq_of_initial
- registered in Physlib.lean

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Codex GPT-5.6 <noreply@openai.com>

* feat(ClassicalMechanics): SimplePendulum time-reversal symmetry and local existence

- deriv_comp_neg and deriv_deriv_comp_neg: the chain rule for ∂ₜ under t ↦ -t and its
  second-order form (general Time.deriv facts, promotion candidates)
- isSolution_comp_neg: the time reversal of a solution is a solution (no velocity term)
- releasedFromRest_even: a solution released from rest is even in time, by uniqueness
- phaseVectorField_contDiff: the phase-space vector field is smooth
- deriv_comp_toRealCLE_of_hasDerivAt: converse bridge from HasDerivAt on ℝ to ∂ₜ on Time
  (promotion candidate)
- inertia_smul_eq_torque: pointwise equation of motion in terms of ω
- exists_local_solution: for any initial angle and angular velocity, a curve with that
  initial data satisfying the equation of motion for |t| ≤ ε, via Mathlib's
  ContDiffAt.exists_forall_mem_closedBall_exists_eq_forall_mem_Ioo_hasDerivAt₀
- module doc (overview, key results, TOC, references) and API-map rows for uniqueness
  and existence

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Codex GPT-5.6 <noreply@openai.com>

* fix(ClassicalMechanics): review fixes for the simple pendulum solution module

- exists_local_solution: the conclusion now carries DifferentiableAt ℝ θ t and
  DifferentiableAt ℝ (∂ₜ θ) t for |t| ≤ ε, so the equation of motion there is a statement
  about genuine derivatives and not about the value ∂ₜ assigns where a curve is not
  differentiable; docstring, §E prose, Key results, Overview and the API-map row now say
  "a curve with that initial data satisfying the equation of motion"
- use the promoted Time.deriv_comp_neg, Time.deriv_deriv_comp_neg and
  Time.deriv_comp_toRealCLE_of_hasDerivAt; the local copies and the subsections that held
  them (D.1, E.2) are removed and sections D and E renumbered, with the TOC 1:1
- inertia_smul_eq_torque moved to §B.1 beside acceleration_eq_of_equationOfMotion
- §E: global existence is not proved here, without implying it is one step away
- the second component of the phase-space vector field is -ω² sin θ (§A prose and the
  phaseVectorField_lipschitz docstring)
- §iv references header covers the motion, the phase plane and the ODE existence and
  uniqueness theorem

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Codex GPT-5.6 <noreply@openai.com>

* refactor(ClassicalMechanics): review golfing for the simple pendulum solution module

All eight suggestions from review applied on leanprover-community#1575: collapsed namespace (with the matching `end`),
golfed the Lipschitz bound, `inertia_smul_eq_torque`, `acceleration_eq_of_equationOfMotion`,
`phaseCurve_hasDerivAt`, `equationOfMotion_unique` (implicit binders and named arguments),
`IsSolution.eq_of_initial` and `releasedFromRest_even`.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Homi <322615700+Homi@users.noreply.github.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Homi <322615700+Homi@users.noreply.github.com>
leanprover-community#1608)

* feat(OperatorAlgebra): reorganize states, observables, and measurement

Splits the monolithic OperatorAlgebra/Basic.lean vocabulary (Observable,
PositiveElement, Effect, POVM, State) out into dedicated files:

- Observables/Basic.lean, Positive.lean, Effects.lean, Jordan.lean, Lie.lean,
  Projection.lean
- States/Basic.lean, Convex.lean, Pure.lean, Statistics.lean, Uncertainty.lean
- Measurement/POVM.lean, Measurement/SpectralMeasure.lean

OperatorAlgebra/Basic.lean keeps only Unitary and Channel, the algebraic
starting point for dynamics.

Fixes a simpNF violation in State.toContinuousLinearMap_one along the way.

Replaces leanprover-community#1590.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UfaHTcti1B3LDEiroauoJe

* fixup: drop Measurement/POVM.lean

Not needed by anything else in this PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UfaHTcti1B3LDEiroauoJe

* refactor: move OperatorAlgebra to PhyslibAlpha

The states/observables/measurement reorganization isn't ready for the
public Physlib surface yet, so relocate the whole
QuantumMechanics/OperatorAlgebra folder under PhyslibAlpha and repoint
Physlib.lean/PhyslibAlpha.lean accordingly. Internal imports within the
folder are updated to the new PhyslibAlpha path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jv3aja8R6JnqJTvmsjuGxF

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Formalize the informal lemma tagged EVJJI: a closed form for the
thermodynamic entropy of the two-state canonical ensemble,

  S = kB * (log (2 * cosh x) - x * tanh x),  where x = beta T * (E1 - E0) / 2

proved via `thermodynamicEntropy_eq_shannonEntropy`, which carries no side
conditions, rather than through the Helmholtz free energy.

Also adds `twoState_entropy_eq_T_neq_zero`, a restatement carrying `T != 0`
so downstream results on positive temperatures get a matching signature, and
drops the `Physlib.Meta.Informal.Basic` import, now unused in this file.

Co-authored-by: Claude Opus 5 <no-reply+claude-opus-5@anthropic.com>
… post-leanprover-community#1608 merge (leanprover-community#1607)

PR leanprover-community#1608 (reorganize states, observables, and measurement) merged into
master first, and had independently moved
Physlib/QuantumMechanics/OperatorAlgebra to
PhyslibAlpha/QuantumMechanics/OperatorAlgebra (with a reorg splitting
Observable/State/Effect/PositiveElement/POVM into their own files).
PR leanprover-community#1607's branch had independently made the same folder move on top
of the pre-reorg layout, producing "added in both" conflicts at the
new PhyslibAlpha paths that git couldn't resolve as a 3-way merge.

Rebuilds this branch on top of current master:
- Basic.lean, HilbertSpace.lean, Observables/{Jordan,Lie}.lean under
  PhyslibAlpha/QuantumMechanics/OperatorAlgebra/ are left as master's
  post-reorg versions (PR leanprover-community#1607 never intended to touch them).
- Dynamics/Automorphism.lean: master's current file plus PR leanprover-community#1607's
  unitary-automorphism-group additions (AutomorphismGroup structure,
  conjugation, the UnitaryOneParameterGroup.toAutomorphism
  construction and its differential/uniqueness characterization),
  with imports updated for the post-leanprover-community#1608 module layout (Observables.Lie
  now lives under PhyslibAlpha).
- Dynamics/Hamiltonian.lean: new file, PR leanprover-community#1607's Hamiltonian dynamics
  content (unitaryEvolution, hamiltonianFlow, equivariance, Heisenberg
  equation, and the classification of Hamiltonians up to conjugation
  and scalar shift), with its Automorphism import updated to
  PhyslibAlpha.
- Physlib/Mathematics/OneParameterSubgroups/Unitary.lean: adds
  commute_generator, hasDerivAt, hasDerivAt_star (unaffected by the
  folder move, applies cleanly on top of master).
- PhyslibAlpha.lean: adds the missing import line for the new
  Dynamics.Hamiltonian module (Dynamics.Automorphism was already
  imported via leanprover-community#1608's merge).
- Physlib.lean: unchanged (already has no OperatorAlgebra imports
  post-leanprover-community#1608).

Verified: `lake build` (full) succeeds with 0 errors, and
scripts/PhyslibAlpha/noAlphaImports.py reports no violations.


Claude-Session: https://claude.ai/code/session_01Jv3aja8R6JnqJTvmsjuGxF

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…eanprover-community#1600)

* feat(Units): component lemmas for the Exponent power of a dimension

`Pow (Dimension B) Exponent` is the default instance, so an unascribed numeric
exponent — `d ^ 2`, `d ^ (1/2)` — elaborates to an `Exponent` power rather than
to the `ℕ` one. The named component lemmas `npow_length`, `npow_time`, … match
the `ℕ` power only, so `simp` could not reach a goal about the component of such
a power.

Add the `Exponent`-power twins `epow_length`, `epow_time`, `epow_mass`,
`epow_charge`, `epow_temperature`, derived through a `component_epow` helper
mirroring the existing `component_npow`. The `ℕ` power is unaffected.

Closes leanprover-community#1580.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* public visibility for component_epow

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…prover-community#1611)

* fix(Tensors): rank the tensor action above the Tensorial action

`Tensorial.smulAction` has `priority := high` so that the diagonal action
on tensor products beats Mathlib's left-only `TensorProduct` action. But
`S.Tensor c` is itself `Tensorial` (via `self`), so a bare `g • t` also
resolved through it, while the `*_equivariant` lemmas are stated with
`Tensor.instSMul`. The two agree only after unfolding `LinearEquiv.refl`,
so `rw`/`simp` could never match those lemmas.

Give `instSMul`, `actionT` and the `DistribMulAction` on `S.Tensor c`
`priority := high + 1`, and register `SMulCommClass` for the tensor action
in both argument orders (as well as the missing symmetric order for
`Tensorial` types). Fifteen `respectTransparency` options become
unnecessary and are removed: twelve in the tensor library and three in
Electromagnetism.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* remove maxheartbeats

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* script with gh actions to find busy reviewers

* fix typo

* updated comments and check all PRs (not just last 30 days)

* dm

* fix indent error

* fix function error

* get rid of exception error

* userID instead of email

* line numbers and labels

* tidy up file

* add recently opened PRs to the summary

* repo updates

* implemented a few claude comments

* Switch Repo Updates trigger to Zulip DM via repository_dispatch

Adds the Cloudflare Worker relay that bridges a Zulip outgoing webhook
(bot receives a DM) to GitHub's repository_dispatch API, replacing the
daily 8am cron trigger.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Create wrangler-account.json

* Remove Wrangler local cache from version control

.wrangler/ is gitignored going forward; this cache/account data
shouldn't have been committed in the first place.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* change so doesnt post to thread

* Move repo-updates workflow, script, and Zulip relay to PhysLibBots

This automation now lives at https://github.com/Alex-Zughaid/PhysLibBots
instead of inside physlib itself.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add monthly diff generation for physlib-website's Monthly Updates page

Backfills Jan-Jun 2026 (monthly-diffs/*.diff + index.json) and adds a
scheduled workflow that generates the previous month's diff automatically
on the 1st of each month, going forward.

* Switch monthly diffs to start/end-of-month added-lines-only format

Instead of concatenating every commit's diff, compute a single diff between
the last commit before the month started and the last commit within the
month, strip all diff syntax, and keep only the raw lines that were added
(grouped by file). Also fixes commit selection to walk the first-parent
chain only - REF's history has merge commits, so two commits picked by date
alone weren't guaranteed to be ancestors of each other, which was inflating
some months' diffs by 5-6x.

* Generate monthly diffs as a Verso/LaTeX PDF instead of plain text

Adds a small Verso (Manual genre) doc project that renders each month's
added lines per file, then compiles that to a PDF with lualatex - mirrors
how Verso builds its own User's Guide PDF. Backfills Jan-Jun 2026 and
updates the scheduled workflow to build and commit the PDF each month
(with Lake/Verso build caching, since a cold build compiles ~450 Lean
files).

* Revert monthly diff generation for the Monthly Updates page

Removes the feature added in 94c58c1, reworked in 21992fb, and
rebuilt on Verso/LaTeX in b0cc792: the generator scripts, the Verso
doc project, the generated PDFs and index.json, and the scheduled
workflow.

The approach wasn't working out. Two problems drove this:

- Month boundaries are resolved by walking --first-parent back from
  upstream/master's tip, which is required to stop non-linear history
  inflating a month's declaration count 5-6x. But the first-parent
  chain is not stable over time - a later merge can re-root the
  mainline, so regenerating a past month yields different contributors
  and line counts than the run that first produced it.
- raw.githubusercontent.com serves the PDFs as application/octet-stream
  with X-Content-Type-Options: nosniff, so a browser can never render
  them inline; the links only ever downloaded a file.

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(ci): review claims, modelled on the intentions bot

Replaces the fixed `reviewing-in-1/2/3-days` labels with comment commands, so a
reviewer can say `claim 5 days` rather than being limited to the windows someone
thought to make a label for, and can claim without repository permissions.

  claim              -- claim this PR for review, for the default 2 day window
  claim 5 days       -- ... for a specific window (hours / days / weeks)
  claim 2026-08-01   -- ... until a specific date
  disclaim           -- release the claim early

The bot requests a review from the claimant, assigns them, applies
`review-claimed` and keeps one status comment per PR whose hidden marker carries
the whole claim record, edited in place as the claim is extended, completed or
released. Reviewing completes the claim; `review_claim_expiry.yml` reminds the
claimant 48h and 24h before the deadline and releases stale claims hourly, so
nothing stays blocked forever.

A claim that runs out without a review takes the claimant back off the PR as
reviewer and assignee, and is announced on the `PR reviews` Zulip topic so that
somebody else can pick the PR up -- using the same bot credentials as the
workers in Alex-Zughaid/PhysLibBots. Only failures are announced. Missing Zulip
secrets or a Zulip outage downgrade to a warning: releasing the claim on GitHub
matters more than announcing it.

A claim is cooperative rather than a lock: anyone may review a claimed PR. The
one thing the bot refuses is silently overwriting a live claim -- a second
`claim` is answered with who holds it and until when -- while the claimant can
always `disclaim` and maintainers can release a claim on someone else's behalf.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(ci): review claims, modelled on the intentions bot

Replaces the fixed `reviewing-in-1/2/3-days` labels with comment commands, so a
reviewer can say `claim 5 days` rather than being limited to the windows someone
thought to make a label for, and can claim without repository permissions.

  claim              -- claim this PR for review, for the default 2 day window
  claim 5 days       -- ... for a specific window (hours / days / weeks)
  claim 2026-08-01   -- ... until a specific date
  disclaim           -- release the claim early

The bot requests a review from the claimant, assigns them, applies
`review-claimed` and keeps one status comment per PR whose hidden marker carries
the whole claim record, edited in place as the claim is extended, completed or
released. Reviewing completes the claim; `review_claim_expiry.yml` reminds the
claimant 48h and 24h before the deadline and releases stale claims hourly, so
nothing stays blocked forever.

A claim that runs out without a review takes the claimant back off the PR as
reviewer and assignee, and is announced on the `PR reviews` Zulip topic so that
somebody else can pick the PR up -- using the same bot credentials as the
workers in Alex-Zughaid/PhysLibBots. Only failures are announced. Missing Zulip
secrets or a Zulip outage downgrade to a warning: releasing the claim on GitHub
matters more than announcing it.

A claim is cooperative rather than a lock: anyone may review a claimed PR. The
one thing the bot refuses is silently overwriting a live claim -- a second
`claim` is answered with who holds it and until when -- while the claimant can
always `disclaim` and maintainers can release a claim on someone else's behalf.

All three jobs are guarded on `github.repository`, as in `add_label_from_diff.yaml`
and `pr_size_label.yaml`, so that forks do not run them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Update ReviewGuidelines.md

* refactor(ci): move the review claim logic to scripts/review_claim.py

Ports the claim logic from JavaScript running inside `actions/github-script` to
Python, and moves it next to the repository's other Python tooling in `scripts/`
rather than hiding it under `.github/scripts/`.

The two workflows are now thin wrappers: each sparse-checks-out that one file
and runs `python scripts/review_claim.py comment|review|expire`. The script is
stdlib-only -- urllib against the REST API -- so the jobs need no dependency
install, and it can be run by hand against a repository with a GITHUB_TOKEN.

Behaviour is unchanged, except that the claim record in the status comment now
stores ISO 8601 timestamps rather than epoch milliseconds, which reads better
for anyone looking at the comment source.

The jobs run the runner's preinstalled `python3` rather than setting up their
own: the script is stdlib-only, so `actions/setup-python` bought nothing but a
Node 20 deprecation warning and a slower job.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…d inner_eq_sum (leanprover-community#1610)

* feat(Vector): mark Vector and CoVector implicit_reducible, add inner_eq_sum

`Lorentz.Vector` and `Lorentz.CoVector` are plain `def`s applied directly
as functions throughout the library. Under Lean 4.33's
`backward.isDefEq.respectTransparency.types` such applications are not
type-correct at implicit transparency, which stops `rw`/`simp` matching
patterns containing them. Marking both `@[implicit_reducible]` is the fix
recommended by the release notes.

Adds `inner_eq_sum` for both types; `basis_inner`/`inner_basis` are
reproved from it, and the `erw`s in `basis_apply`/`basis_repr_apply`
become plain `rw`. In total 21 `respectTransparency` options become
unnecessary (2 in Vector/Basic, 19 in the Vector/CoVector tensorial,
representation and contraction files) and are removed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(Vector): drop simp exclusions, add CoVector.equivEuclid_apply

The `-Fintype.sum_sum_type` exclusions in `inner_eq_sum`, `basis_inner`
and `inner_basis` were unnecessary. `CoVector.equivEuclid_apply` mirrors
the existing `Vector.equivEuclid_apply` simp lemma, which removes the
manual `rfl` from `CoVector.inner_eq_sum`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(CoVector): drop unused inner_eq_sum and equivEuclid_apply

The Euclidean inner product on `CoVector` has no consumers in the library,
so these lemmas were speculative API. `CoVector` keeps only the
`implicit_reducible` attribute, the `erw` removals and the docstring fix.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* change implicit_reducible tag

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…evaluation components (leanprover-community#1614)

* refactor(Electromagnetism): replace fieldStrengthMatrix with index-evaluation components

Resolves both TODOs in FieldStrength.lean. Components of the field strength
tensor are now accessed via `toField {A.toFieldStrength x | [μ] [ν]}ᵀ`
everywhere; `fieldStrengthMatrix` and the Finsupp-representation lemmas are
removed and replaced by `toFieldStrength_eval_*` lemmas.

To allow concrete indices such as `[Sum.inl 0]`, the tensor index-evaluation
bracket syntax in Relativity/Tensors/Elab.lean is widened from `ident` to
`term`.

Files using `simp` on evaluation terms gain
`attribute [-simp] Fin.succAbove_zero`, matching the guard already used in
the tensor library.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(Electromagnetism): option-free canonicalMomentum_eq; drop MinkowskiProduct options

`canonicalMomentum_eq` is reproved through `Lorentz.Vector.inner_eq_sum`
without `backward.isDefEq.respectTransparency` (possible now that
`Lorentz.Vector` is implicit-reducible). The two remaining options in
`Vector/MinkowskiProduct.lean` need both the implicit-reducible change and
the tensor-action priority fix, so they are removed here, on top of both.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(Electromagnetism): drop unneeded Fin.succAbove_zero guard in two files

IsExtrema and GaugeTransformation compile without it; Boosts, MagneticField,
KineticTerm and Hamiltonian still need it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(FieldStrength): drop simp attribute on toFieldStrength_eval_diag_eq_zero

The simpNF linter runs without the file-local `Fin.succAbove_zero` guard, under
which the eval left-hand side is not in simp normal form. The lemma is now
passed explicitly at the five `simp` sites that relied on it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(FieldStrength): keep the basis-lemma TODO; resolved in the follow-up PR

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…netic potential (leanprover-community#1616)

* feat(Electromagnetism): differentiability of the derivative of the electromagnetic potential

Resolves the TODO in `EMPotential.lean` asking for results on the
differentiability of the derivative of the electromagnetic potential.

In `Physlib/Electromagnetism/Kinematics/EMPotential.lean`:
- `contDiff_deriv_of_smooth`: `∂_ μ A x ν` is `C^n` for a smooth potential.
- `contDiff_deriv_deriv`, `differentiable_deriv_deriv`,
  `differentiable_deriv_deriv_of_smooth`: the second derivatives
  `∂_ μ (∂_ ν A) x ρ` are `C^n` for a `C^{n+2}` potential, and differentiable
  for a `C^3` (or smooth) potential.
- `deriv_differentiable`, `deriv_differentiable_of_smooth`, `deriv_contDiff`:
  the derivative tensor `A.deriv` is differentiable for a `C^2` potential and
  `C^n` for a `C^{n+1}` potential.
- Fix the table of contents (the constructor-differentiability section was
  missing and two sections shared the number A.5).

In `Physlib/Electromagnetism/Kinematics/FieldStrength.lean`:
- Golf `fieldStrengthMatrix_differentiable` and `fieldStrengthMatrix_contDiff`
  to use `differentiable_deriv`/`contDiff_deriv` via `fun_prop` instead of
  re-deriving them inline.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(EMPotential): rename derivative differentiability lemmas by object

Lemmas about the derivative tensor `A.deriv` now carry the plain names
`differentiable_deriv`, `differentiable_deriv_of_smooth`, `contDiff_deriv`
(matching `differentiable_toFieldStrength`), while lemmas about a component
`∂_ μ A x ν` carry a `_component` suffix (matching `differentiable_component`):

- `differentiable_deriv` → `differentiable_deriv_component`
- `differentiable_deriv_of_smooth` → `differentiable_deriv_component_of_smooth`
- `contDiff_deriv` → `contDiff_deriv_component`
- `contDiff_deriv_of_smooth` → `contDiff_deriv_component_of_smooth`
- `contDiff_deriv_deriv` → `contDiff_deriv_deriv_component`
- `differentiable_deriv_deriv` → `differentiable_deriv_deriv_component`
- `differentiable_deriv_deriv_of_smooth` → `differentiable_deriv_deriv_component_of_smooth`
- `deriv_differentiable` → `differentiable_deriv`
- `deriv_differentiable_of_smooth` → `differentiable_deriv_of_smooth`
- `deriv_contDiff` → `contDiff_deriv`

No file outside `EMPotential.lean` referred to the old names.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

* feat(EMPotential): differentiability of the components of `∂_ μ (∂_ ν A)`

Add the second statement shape for second derivatives of the potential,
where the vector-valued derivative is formed first and the component taken
afterwards:

- `contDiff_deriv_deriv_apply` : `∂_ μ (∂_ ν A) x ρ` is `C^n` for a `C^{n+2}` potential.
- `differentiable_deriv_deriv_apply` : differentiable for a `C^3` potential.
- `differentiable_deriv_deriv_apply_of_smooth` : differentiable for a smooth potential.

Proofs reduce to the `_component` lemmas via `SpaceTime.deriv_apply_eq`.
The section docstring explains the `_component` / `_apply` distinction, and an
over-long "Key results" line is re-wrapped.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

* chore(EMPotential): remove stale `respectTransparency` options

All nine `set_option backward.isDefEq.respectTransparency false in` lines in
`EMPotential.lean` are no longer needed after `Lorentz.Vector` was marked
`implicit_reducible` (leanprover-community#1610); the file compiles without them.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(EMPotential): drop derivative lemmas that `fun_prop` proves directly

Remove the lemmas whose statements a bare `fun_prop` already proves from
`SpaceTime.differentiable_deriv`/`SpaceTime.contDiff_deriv` and the
`Lorentz.Vector` component lemmas, so they added nothing to the search:

- `differentiable_deriv_component`, `contDiff_deriv_component`
- `differentiable_deriv_deriv_component`, `differentiable_deriv_deriv_component_of_smooth`
- `differentiable_deriv_deriv_apply`

Kept are the lemmas `fun_prop` cannot derive on its own: the `_of_smooth`
variants (`fun_prop` does not lower `ContDiff ℝ ∞`), the `C^{n+2}` second
derivative lemmas (symbolic `n + 2` does not unify with `?m + 1`), and the
derivative-tensor lemmas (need `unfold deriv`). Their proofs now obtain the
needed finite-order hypothesis with `have` and finish by `fun_prop`.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(EMPotential): drop `differentiable_component`, provable by `fun_prop`

`Differentiable ℝ (fun x => A x μ)` for a differentiable potential is found by
`fun_prop` directly, so the lemma is removed; its single by-name use in
`ElectricField.lean` becomes `fun_prop`.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…er-community#1615)

* refactor(FieldStrength): remove basis-representation lemmas

The field-strength-specific basis-representation lemmas
(`toTensor_toFieldStrength_basis_repr`, `toFieldStrength_tensor_basis_eq_basis`,
`toFieldStrength_eval_eq_basis_repr`) are removed, completing the second
TODO. The two generic facts they relied on now live in the tensor library
as lemmas about any `F : Vector d ⊗ Vector d`.

Antisymmetry, equivariance and linearity of the tensor are derived from
their component versions. Four `respectTransparency` options in
FieldStrength.lean become unnecessary and are dropped.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* chore(FieldStrength): golf proofs

Rewrite in one top-level `simp only` and close by `rfl` instead of navigating
into subterms; use structured `induction … with`; derive
`toFieldStrength_action_eq_sum` from the component equivariance.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* change ext

* indentation

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…r-community#1612)

* feat(ClassicalMechanics): forces and Newtonian point-particle systems

* refactor(ClassicalMechanics): split Newtonian system into own module, rename vel/acc

* docs(ClassicalMechanics): justify force, particle, and system definitions

* refactor(ClassicalMechanics): rename PointParticle.System to NewtonianSystem

* refactor(ClassicalMechanics): rename PointParticle/Defs to Basic, address review
…dinate chain rule (leanprover-community#1618)

The Time derivative API states its regularity results for smooth curves only.
This adds the finite-order versions needed for `C²` dynamics, where solutions
of an equation of motion are twice but not infinitely differentiable:

- `Time.deriv_contDiff_of_contDiff_succ`: the derivative of a `C^(n+1)` curve
  is `C^n` (the finite-order form of `Time.deriv_contDiff_of_contDiff`).
- `Time.deriv_differentiable_of_contDiff_two`: the derivative of a `C²` curve
  is differentiable.
- `Time.deriv_comp_coord`: chain rule for a real function of one coordinate of
  a curve in Euclidean space, the time-derivative counterpart of
  `gradient_comp_coord`.
- `Time.deriv_deriv_comp_neg`: hypothesis weakened from smooth to `C²`, which
  is all the proof uses; the one caller in `SimplePendulum` is updated.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ity#1613)

* standard format for references

* messy references

* Update README.md

* removed zulip

* added back some information that was lost

* Delete .axiomatic/search_lean/.gitignore

* fixed arxiv references

* fixed a few more references

* fixed some others

* found the papers for the remaining 2

* small fix

* Update Physlib/Relativity/Fermions/Weyl/DualLeftHanded.lean

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>

* Update Physlib/Relativity/LorentzGroup/Boosts/Generalized.lean

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>

* Update Physlib/Relativity/LorentzGroup/Boosts/Generalized.lean

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>

* Update Physlib/StringTheory/FTheory/SU5/Quanta/IsViable.lean

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>

* Update Physlib/StringTheory/FTheory/SU5/Basic.lean

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>

* split up long lines

* got rid of italics

* Update Physlib/StringTheory/FTheory/SU5/Quanta/TenQuanta.lean

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>

* Update Physlib/StringTheory/FTheory/SU5/Quanta/FiveQuanta.lean

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>

* Update Physlib/StringTheory/FTheory/SU5/Fluxes/Basic.lean

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>

* Update Physlib/StringTheory/FTheory/SU5/Quanta/Basic.lean

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>

* long lines

* Update Generalized.lean

---------

Co-authored-by: Daniel Morrison <39346894+morrison-daniel@users.noreply.github.com>
Co-authored-by: Joseph Tooby-Smith <72603918+jstoobysmith@users.noreply.github.com>
A self-contained treatment of Norton's dome: a point mass on a dome whose
equation of motion has a continuous but non-Lipschitz force, so that a mass
at rest on the apex may stay or slide off at any instant. Contains the dome
on the arc length, the family of departing motions and the resulting failure
of uniqueness, the dome in physical space, a minimal notion of conservative
Newtonian system with determinism, the first law and the candidate regularity
conditions as predicates, the theorem that a locally Lipschitz force gives
determinism, and the theorems that the dome fails every one of these
conditions. Peano's existence theorem is recorded as a sorried statement
from Mathlib PR #42148.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Adds PhyslibAlpha/AlgebraicFramework/, an order-unit-space-first treatment
of states, effects, channels, measurements, and C*-algebra observables,
together with the first slice of the unbounded-operator spectral theorem
(Cayley transform, spectral integrals, and both directions of Stone's
theorem). Supersedes and removes QuantumMechanics/OperatorAlgebra, which
covered overlapping ground under the same declaration names.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Add omit/@[nolint unusedArguments] where a typeclass or hypothesis is
  genuinely unused (or intentionally retained for API-signature parity,
  as documented in CandidateGenerator.lean).
- Drop unused [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] from
  Covariance/Finite.lean's marginal_isCovariant, which didn't need them.
- Add hTe, hSA, hsI, hax to .codespellignore: hypothesis-variable names
  codespell mistook for misspelled English words.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…older

Every OrderUnit module now follows the numbered-section convention (Overview,
Key definitions/results, Table of contents, lettered sections), matching the
rest of AlgebraicFramework.

Also fixes a build break in Composite.lean's TensorCone.instPartialOrder:
TensorCone.ext takes E₁ E₂ explicitly (inherited from the section variable),
so the le_antisymm field needs them supplied explicitly rather than relying
on unification from a single positional argument.

Symmetry.lean's new unitsEquiv also had three unused-variable lint warnings
in its MulEquiv fields, fixed by using _ for the unreferenced binders.

JordanDecomposition.lean drops its now-stale cross-reference to Composite.lean's
tensor-product order-unit gap (exists_sub_mem_maxConeSet), which nothing
references.

Verified: lake build -KCI PhyslibAlpha succeeds with zero errors, runPhyslibAlphaLinters
and noAlphaImports pass, and the Python style linters (alphaPythonLinters.sh) pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…on, trace-class infrastructure

Extends AlgebraicFramework with the Jordan-algebraic order-unit hierarchy and closes several
gaps identified against external Lean libraries (adambornemann-glitch/Spectra,
Cobord/JordanAlgebra, and the sibling unbounded-alpha-public branch), while keeping the
abstract Jordan/JB/JBW layers independent of any concrete Cstar/Hilbert-space realization.

- JordanOrderUnit/: quadratic representation, Jordan triple product, inner derivations and the
  structure-algebra toolkit (D_{a,b}, V_{a,b}), proving the fundamental formula for quadratic
  representations U(U a b) = U a * U b * U a (quadRep_fundamental) via the triple-operator
  commutator identity. JB/ and JBW/ layers (generated-by-one continuous functional calculus,
  square-root uniqueness, spectrum, projection resolutions), Power/, Quadratic/, and an
  Examples/SpinFactor instance.
- Algebra/: Alternative, NuclearInvolution, Derivation, Statistics — bare algebraic notions
  factored out independent of Jordan order, norms, or dynamics.
- Dynamics/: OneParameterGroup, Generator, and the bridge theorem that a one-parameter
  automorphism group's generator is a derivation.
- CStarAlgebra/: Jordan, JordanCFC, JordanCompatibility, JordanPositivity, JordanSpecial,
  JordanStatistics — the concrete realization discharging the abstract Jordan capabilities.
- CStarAlgebra/Stinespring/: Stinespring's dilation theorem for completely positive maps into
  B(H), the general framework Naimark's theorem is a special case of.
- HilbertSpace/TraceClass/: Hilbert-Schmidt operators, polar decomposition, and the general
  product/ideal-norm theory needed for a genuine trace-class Banach space, closing a prerequisite
  gap that was entirely absent from Mathlib.
- HilbertSpace/Unbounded/EssentialSpectrum/: essential spectrum and Weyl's theorem on its
  invariance under relatively compact perturbation.
- OrderUnit/, Measurement/, StarAlgebra/, Representation/: assorted extensions (monotone
  completeness, weight/state equivalence and separation, bounded scalarization, probability
  law, discrete Naimark dilation) supporting the above.

All new/modified files build clean under `lake build PhyslibAlpha`, are free of `sorry`/`admit`/
non-standard axioms, and pass `sorry_lint`/`style_lint`/the PhyslibAlpha python linters.

EXTERNAL_INTEGRATION_PLAN.md records the full investigation of the three external sources: what
was ported, what was independently reproduced and kept instead, and what remains (Tomita-Takesaki
modular theory, the remaining trace-class density theorem for WStarAlgebra(B(H))'s predual).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…aic-framework PR

# Conflicts:
#	PhyslibAlpha/Mathematics/LadderSystem/Basic.lean
#	PhyslibAlpha/Mathematics/LadderSystem/Irreducibility.lean
#	PhyslibAlpha/Mathematics/LadderSystem/OccupationBasis.lean
#	PhyslibAlpha/Mathematics/LadderSystem/SymmetricPower.lean
#	PhyslibAlpha/Mathematics/LadderSystem/Vacuum.lean
#	PhyslibAlpha/QuantumMechanics/HarmonicOscillator/Basic.lean
#	PhyslibAlpha/QuantumMechanics/HarmonicOscillator/LadderOperators.lean
#	PhyslibAlpha/QuantumMechanics/HarmonicOscillator/Vacuum.lean
@github-actions

Copy link
Copy Markdown

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.

  1. Some automated checks will be run on your PR. You can see the results of these checks at the buttom of your PR page. If any of these checks fail, you will need to fix the issues before your PR can be merged. You can learn more about these here, including how to run them locally, which is sometimes quicker than relying on the GitHub Actions. If you have never had a PR merged before, you may have to wait for a reviewer to manually start these checks (this is for security).

  2. A reviewer will look at your PR and may ask you to make changes. This may happen a couple of days after you submit your PR, so you may need to be patient. But it should not be longer than that - if it is please bring it to the attention of the community on the Zulip. The level of review will depend on where your PR is submitted. If it is submitted to ./Physlib or ./QuantumInfo, the review will be more thorough than if it is submitted to ./PhyslibAlpha. You can find out more about what the review process is looking for in our review guidelines. If a reviewer adds an awaiting-author label to your PR, address the review comments, then please remove that label by adding a comment with -awaiting-author. This helps us keep track of reviews.

  3. The reviewer will either approve your PR, or request more changes (in which case we return to step 2). Once your PR is approved, it will be merged by a maintainer, this should happen shortly after approval, though you may get more comments at this stage.

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.

@TomOleDiem

Copy link
Copy Markdown
Owner Author

Wrong target repo — opening against leanprover-community/physlib instead.

@TomOleDiem TomOleDiem closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.