Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
2310526
refactor(QED): name even anomaly-cancellation planes (#1507)
catlover-bot Aug 11, 2026
cf1d86d
feat(QuantumMechanics/Hydrogen): prove angularMomentum_commutation_lr…
TomOleDiem Aug 11, 2026
1d839cd
Add initial condensed matter directory structure (#1498)
WahajAyub Aug 12, 2026
f3da8ce
docs(quantum-info): add qubit API map (#1501)
Robby955 Aug 12, 2026
c6e61dc
docs(QuantumMechanics): add Hilbert space tensor product API-map (#1512)
gloges Aug 12, 2026
0db6a7b
docs(cosmology): add FLRW API map (#1513)
Robby955 Aug 13, 2026
85bc51c
perf(Relativity): remove erw from Levi-Civita contractions (#1517)
catlover-bot Aug 14, 2026
8b7371a
refactor(QuantumMechanics): move `ReflectionlessPotential` over to `S…
gloges Aug 14, 2026
a7a6d46
feat(SpaceAndTime): add reference frames (#1519)
RaunakChhatwal Aug 14, 2026
2f3c57e
docs(operators): add quantum operators API map (#1515)
Robby955 Aug 15, 2026
ba2a946
feat(QuantumMechanics): add `positionState` and `momentumState` (#1520)
gloges Aug 15, 2026
a50684a
chore: Bump 4.33 (#1521)
NicolasRouquette Aug 17, 2026
84507e3
Ladder Operators & Harmonic Oscillator (#1522)
TomOleDiem Aug 17, 2026
6fb892c
Pauli matrices: vector identities and self-adjoint decomposition (#1524)
TomOleDiem Aug 17, 2026
fdebdbb
Add PR size labeling workflow (#1527)
Alex-Zughaid Aug 17, 2026
19378fb
docs(units): add units and dimensions API map (#1516)
Robby955 Aug 18, 2026
4e15f2b
Stone theorem for norm-continuous unitary one-parameter groups (#1510)
TomOleDiem Aug 18, 2026
ef9a592
Migrating NoAlphaImport Python Script to Lean (#1545)
FergusMunro Aug 18, 2026
704bb33
feat(QuantumMechanics): add QHO eigenstates (#1523)
gloges Aug 19, 2026
476d92a
fix doc: correct FiedOpAlgebra to FieldOpFreeAlgebra in section headi…
Jah-yee Aug 19, 2026
9328f56
feat(Relativity): add evalT_evalT (#1546)
catlover-bot Aug 20, 2026
6437336
Add coordinate-axis boosts in SL(2, ℂ) (#1547)
nateabr Aug 20, 2026
823a7fe
feat(Relativity): add pointwise succSuccAbove commutation (#1548)
catlover-bot Aug 20, 2026
49ee90e
feat(Units): add scaling API for ISQ unit types (#1551)
catlover-bot Aug 20, 2026
7194c0a
docs(reference-frame): reference frame API map (#1553)
Robby955 Aug 20, 2026
e3e9d9b
feat(OperatorAlgebra): start the operator algebra formalization (#1550)
TomOleDiem Aug 20, 2026
de0e7cb
docs(temperature): temperature API map (#1554)
Robby955 Aug 20, 2026
665cf2b
Migrating alpha file import to lean + adding testing (#1552)
FergusMunro Aug 21, 2026
8edacb9
chore: remove 53 defeq set_option (#1557)
zhikaip Aug 22, 2026
846bc68
feat(Mathematics): shared gradient lemmas, used by the oscillators (#…
aadarwal Aug 22, 2026
7b6e0fe
Fix tensor product documentation examples (#1562)
utkarshr3144 Aug 22, 2026
8381cbf
feat(ClassicalMechanics): the simple pendulum's configuration space (…
aadarwal Aug 23, 2026
77b3e6b
The Lie product on observables (#1558)
TomOleDiem Aug 23, 2026
1bf7760
Fix position operator documentation (#1563)
utkarshr3144 Aug 24, 2026
e3cc997
fix(tensors): correct cyclic permutation elaboration (#1567)
Robby955 Aug 24, 2026
485cb13
feat(ClassicalMechanics): the simple pendulum's dynamics, Lagrangian …
aadarwal Aug 24, 2026
4a4de62
The Jordan product on observables (#1559)
TomOleDiem Aug 24, 2026
8f9a40b
The static theorem for reversible dynamics on Hilbert spaces (#1556)
TomOleDiem Aug 25, 2026
6be0ec0
feat(Mathematics): Real.completeEllipticK, Legendre's complete ellipt…
aadarwal Aug 25, 2026
f6d7fe3
feat(ClassicalMechanics): simple pendulum conservation, equilibria an…
aadarwal Aug 25, 2026
9c33f2c
docs(Relativity): correct dimension in Levi-Civita contraction module…
oe-parks Aug 27, 2026
3405d86
feat(Units): reducible rational arithmetic via Exponent (#1579)
RaunakChhatwal Aug 27, 2026
0e2dda9
feat(tensors): prove the Levi-Civita contraction identities (#1565)
Robby955 Aug 27, 2026
33d9937
feat(ClassicalMechanics): Hamiltonian formulation of the simple pendu…
aadarwal Aug 27, 2026
26939f1
docs: drop undefined Pauli tensor notation from module header (#1584)
sankalpsthakur Aug 28, 2026
1395e18
feat(pauli): prove the epsilon triple-product identities (#1568)
Robby955 Aug 28, 2026
e90e780
feat: Lake cache workflow (#1582)
Alex-Zughaid Aug 28, 2026
73977f6
docs: fix ContrMod equivalence docstring (real, not complex) (#1585)
sankalpsthakur Aug 28, 2026
e605b91
Use the R2 storage cache to speed up build of Physlib + PhyslibAlpha …
Alex-Zughaid Aug 28, 2026
e1cd3b4
feat(ClassicalMechanics): pendulum trajectories on the configuration …
aadarwal Aug 28, 2026
bc424ff
refactor(Time): general lemmas for the time derivative under reparame…
aadarwal Aug 28, 2026
e7e13e6
feat(ClassicalMechanics): the small-angle regime of the simple pendul…
aadarwal Aug 30, 2026
686d93d
Add lattice QFT stub module (#1589)
Rahul-pamula Aug 30, 2026
12e16cf
Update README with library sections and descriptions (#1596)
jstoobysmith Aug 31, 2026
3af7ebc
Reimprove readme (#1598)
jstoobysmith Sep 1, 2026
7f398ad
feat(ClassicalMechanics): SimplePendulum.periodFormula, the classical…
aadarwal Sep 1, 2026
e17ea61
publish-cache needs fetch-depth 0 too (#1591)
Alex-Zughaid Sep 1, 2026
b651a4a
refactor(SpaceAndTime): move cmap and cmap_apply to Space/SmoothFunct…
giuseppesorge Sep 1, 2026
4d89aff
feat: time derivative of trajectories into torsors as derivVec (#1592)
zhikaip Sep 1, 2026
9dec777
feat(ClassicalMechanics): existence and uniqueness for the nonlinear …
aadarwal Sep 1, 2026
e209ba1
refactor(ClassicalMechanics): switch to derivVec for simple-pendulum …
zhikaip Sep 2, 2026
4b8202e
refactor(ClassicalMechanics): rigid-body velocities and momentum valu…
zhikaip Sep 2, 2026
119fd70
feat(OperatorAlgebra): reorganize states, observables, and measuremen…
TomOleDiem Sep 2, 2026
170a753
EVJJI theorem twoState_entropy_eq (#1605)
oe-parks Sep 2, 2026
a4ba9ef
fix(OperatorAlgebra): rebase PR #1607 onto master post-#1608 merge (#…
TomOleDiem Sep 2, 2026
60b4473
feat(Units): component lemmas for the Exponent power of a dimension (…
NicolasRouquette Sep 3, 2026
bbb33d2
fix(Tensors): rank the tensor action above the Tensorial action (#1611)
zhikaip Sep 3, 2026
c9ae1ba
feat: review claims via comments (#1601)
Alex-Zughaid Sep 3, 2026
c17844a
feat(Lorentz.Vector): mark Vector and CoVector implicit_reducible, ad…
zhikaip Sep 3, 2026
6a09b2d
refactor(Electromagnetism): replace `fieldStrengthMatrix` with index-…
zhikaip Sep 5, 2026
64929cb
feat(EMPotential): differentiability of derivatives of the electromag…
zhikaip Sep 7, 2026
67d7427
refactor(FieldStrength): remove basis-representation lemmas (#1615)
zhikaip Sep 7, 2026
e6450df
feat(ClassicalMechanics): Newtonian point-particle systems (#1612)
RaunakChhatwal Sep 8, 2026
d2159de
feat(Time): finite-order regularity of the time derivative and a coor…
zhikaip Sep 8, 2026
715f2ac
Improve how references are used throughout Physlib (#1613)
Alex-Zughaid Sep 9, 2026
142f41c
feat(PhyslibAlpha): the Norton dome (#1619)
zhikaip Sep 9, 2026
79b62ac
Replace OperatorAlgebra with AlgebraicFramework
TomOleDiem Sep 9, 2026
4ac9011
Fix CI lint failures: unusedArguments and spelling
TomOleDiem Sep 9, 2026
6aa6e75
docs(OrderUnit): standardize module documentation layout across the f…
TomOleDiem Sep 9, 2026
0a07cc8
feat(AlgebraicFramework): Jordan/JB/JBW hierarchy, Stinespring dilati…
TomOleDiem Sep 13, 2026
7e9f28b
Merge fork/master (LadderSystem/HarmonicOscillator PR #1) into algebr…
TomOleDiem Sep 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ dOut
SINIC
ofSet
mapP
hTe
hSA
hsI
hax
32 changes: 21 additions & 11 deletions .github/workflows/alphaBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ jobs:
alpha_build:
name: Lean based style linters
runs-on: ubuntu-latest
env:
LAKE_CACHE_DIR: .lake/cache
steps:

# Full history so lake can look back for a commit with a cache, see build.yml
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install elan
run: |
Expand All @@ -29,10 +34,18 @@ jobs:
lean --version
lake --version

- name: build cache
- name: Mathlib build cache
run: |
lake exe cache get

# PhyslibAlpha has its own cache in the bucket so we pull that one
- name: PhyslibAlpha's build cache
env:
LAKE_CONFIG: ${{ github.workspace }}/lake-cache.toml
run: |
lake cache get --scope="physlib-master/$(tr '/:' '--' < lean-toolchain | tr -d '[:space:]')/alpha" \
|| echo "no existing cache to restore -- building from scratch"

- name: build PhyslibAlpha
id: build
uses: liskin/gh-problem-matcher-wrap@v3
Expand All @@ -50,6 +63,13 @@ jobs:
linters: gcc
run: env LEAN_ABORT_ON_PANIC=1 lake exe runPhyslibAlphaLinters

- name: Check no PhyslibAlpha in Physlib and QuantumInfo
run: env LEAN_ABORT_ON_PANIC=1 lake exe noAlphaImports

- name: Check PhyslibAlpha imports
run: env LEAN_ABORT_ON_PANIC=1 lake exe alphaFileImports


style_lint:
name: Python based linters
runs-on: ubuntu-latest
Expand All @@ -73,16 +93,6 @@ jobs:
with:
python-version: 3.8

- name: Check PhyslibAlpha imports
run: |
chmod u+x scripts/PhyslibAlpha/alphaFileImports.py
./scripts/PhyslibAlpha/alphaFileImports.py

- name: Check no PhyslibAlpha in Physlib and QuantumInfo
run: |
chmod u+x scripts/PhyslibAlpha/noAlphaImports.py
./scripts/PhyslibAlpha/noAlphaImports.py

- name: Python linters for PhyslibAlpha
run: |
chmod u+x scripts/PhyslibAlpha/alphaPythonLinters.sh
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ jobs:
doc_lint:
name: Lean based style linters
runs-on: ubuntu-latest
env:
LAKE_CACHE_DIR: .lake/cache
steps:

# Need the full history here, lake looks back through the commits to find
# one with a cache. A shallow clone only has one so it never finds anything.
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install elan
run: |
Expand All @@ -29,10 +35,19 @@ jobs:
lean --version
lake --version

- name: build cache
- name: Mathlib build cache
run: |
lake exe cache get

# Pulls the cache from the bucket so we only compile what the PR changed.
# No key needed as it is only reading. If it fails we just build from scratch.
- name: Physlib's build cache
env:
LAKE_CONFIG: ${{ github.workspace }}/lake-cache.toml
run: |
lake cache get --scope="physlib-master/$(tr '/:' '--' < lean-toolchain | tr -d '[:space:]')/physlib" \
|| echo "no existing cache to restore -- building from scratch"

- name: build Physlib
id: build
uses: liskin/gh-problem-matcher-wrap@v3
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/pr_size_label.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: PR size label

on:
pull_request_target:
types: [opened, synchronize, reopened]

# Limit permissions for GITHUB_TOKEN for the entire workflow
permissions:
contents: read
pull-requests: write # Only allow PR comments/labels
# All other permissions are implicitly 'none'

jobs:
add_size_label:
name: Add size label
runs-on: ubuntu-latest
# Don't run on forks, where we wouldn't have permissions to add the label anyway.
if: github.repository == 'leanprover-community/physlib'
steps:
- name: Label PR by size
uses: actions/github-script@v7
with:
script: |
const SIZES = [
{ label: 'small', color: '2ea44f', max: 100 },
{ label: 'medium', color: 'f66a0a', max: 500 },
{ label: 'large', color: 'd73a4a', max: Infinity },
];

const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});

const changedLines = pr.additions + pr.deletions;
const target = SIZES.find(s => changedLines < s.max) ?? SIZES[SIZES.length - 1];

core.info(`PR #${pr.number}: ${changedLines} lines changed -> ${target.label}`);

// Ensure all three size labels exist with the right color, and remove
// any size label that isn't the one that currently applies.
for (const size of SIZES) {
try {
await github.rest.issues.getLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: size.label,
});
} catch (err) {
if (err.status === 404) {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: size.label,
color: size.color,
});
} else {
throw err;
}
}

if (size.label !== target.label) {
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
name: size.label,
});
} catch (err) {
if (err.status !== 404) throw err;
}
}
}

const existingLabels = pr.labels.map(l => l.name);
if (!existingLabels.includes(target.label)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: [target.label],
});
}
194 changes: 194 additions & 0 deletions .github/workflows/publish-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
on:
push:
branches:
- master

name: Publish build cache

# Pulls the cache from the bucket and then does a build with the new changes that are being merged
# Then it creates a new cache which is pushed to the web bucket where they can be accessed
# by `lake exe get_cache`.

jobs:
# `secrets` is not allowed in a job-level `if:` -- GitHub rejects the whole
# file. Gating on a `needs` output instead skips the build jobs when the
# bucket is not set up yet.
gate:
name: Check for cache credentials
runs-on: ubuntu-latest
outputs:
has_key: ${{ steps.check.outputs.has_key }}
steps:
- name: look for LAKE_CACHE_KEY
id: check
env:
LAKE_CACHE_KEY: ${{ secrets.LAKE_CACHE_KEY }}
run: |
set -euo pipefail
if [ -n "$LAKE_CACHE_KEY" ]; then
echo "has_key=true" >> "$GITHUB_OUTPUT"
else
echo "::notice::LAKE_CACHE_KEY is not set, so the build cache will not be published. See docs/cache-setup.md."
echo "has_key=false" >> "$GITHUB_OUTPUT"
fi

physlib:
name: Physlib + QuantumInfo
needs: gate
if: needs.gate.outputs.has_key == 'true'
runs-on: ubuntu-latest
env:
LAKE_CACHE_DIR: .lake/cache
steps:
# Full history so lake can look back for a commit with a cache,
# a shallow clone only has one so the restore below never finds anything
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Each job needs its own scope: Lake PUTs the revision mappings to
# <revisionEndpoint>/<scope>/<sha>.jsonl, so a shared scope would have
# one job overwrite the other's. The toolchain is in the scope because
# Lake ignores --toolchain for verbatim scopes.
# scripts/get_cache.lean builds the same strings -- keep them in step.
- name: compute cache scope
run: |
set -euo pipefail
TC="$(tr '/:' '--' < lean-toolchain | tr -d '[:space:]')"
echo "CACHE_SCOPE=physlib-master/$TC/physlib" >> "$GITHUB_ENV"

- name: Install elan
run: |
set -o pipefail
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- --default-toolchain none -y
~/.elan/bin/lean --version
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"

- name: build cache
run: |
lake exe cache get

# This reads the existing info in the bucket so that we only have to update whats changed
# If the bucket is empty we will have to build from scratch.
- name: restore Physlib's own cache
env:
LAKE_CONFIG: ${{ github.workspace }}/lake-cache.toml
run: |
lake cache get --scope="$CACHE_SCOPE" || echo "no existing cache to restore -- building from scratch"

- name: build Physlib
run: |
bash -o pipefail -c "env LEAN_ABORT_ON_PANIC=1 lake build -KCI | tee stdout.log"

# `--no-build` here does not build anything; it emits the
# input-to-output mappings for what was just built.
- name: stage build outputs for the cache
id: stage
continue-on-error: true
run: |
set -euo pipefail
mkdir -p ../lake-cache-staging
lake build --no-build -KCI -o .lake/outputs.jsonl
echo "mappings: $(wc -l < .lake/outputs.jsonl) entries"
lake cache stage .lake/outputs.jsonl ../lake-cache-staging
echo "staged: $(find ../lake-cache-staging -name '*.ltar' | wc -l) ltar files"

- name: publish to R2 cache
id: publish
if: steps.stage.outcome == 'success'
continue-on-error: true
env:
LAKE_CACHE_KEY_RAW: ${{ secrets.LAKE_CACHE_KEY }}
LAKE_CONFIG: ${{ github.workspace }}/lake-cache.toml
run: |
set -euo pipefail
# GitHub secrets commonly carry a trailing newline, which breaks the
# SigV4 signature. Trim it, and mask the value so it cannot surface
# in logs.
KEY="$(printf %s "$LAKE_CACHE_KEY_RAW" | sed -e 's/[[:space:]]*$//')"
echo "::add-mask::$KEY"
export LAKE_CACHE_KEY="$KEY"

lake cache put-staged ../lake-cache-staging \
--scope="$CACHE_SCOPE" \
--rev="${{ github.sha }}"

- name: warn if cache publish failed
if: steps.stage.outcome == 'failure' || steps.publish.outcome == 'failure'
run: echo "::warning::Physlib build cache was not published this run (staging or upload failed). Contributors will fall back to compiling from source until the next successful push."

physlib_alpha:
name: PhyslibAlpha
needs: gate
if: needs.gate.outputs.has_key == 'true'
runs-on: ubuntu-latest
env:
LAKE_CACHE_DIR: .lake/cache
steps:
# Full history, see the physlib job above
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Own scope, so this job does not overwrite the physlib job's mappings.
- name: compute cache scope
run: |
set -euo pipefail
TC="$(tr '/:' '--' < lean-toolchain | tr -d '[:space:]')"
echo "CACHE_SCOPE=physlib-master/$TC/alpha" >> "$GITHUB_ENV"

- name: Install elan
run: |
set -o pipefail
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- --default-toolchain none -y
~/.elan/bin/lean --version
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"

- name: build cache
run: |
lake exe cache get

# See the physlib job's "restore Physlib's own cache" step -- same
# idea, seeding from this job's own scope before its build.
- name: restore PhyslibAlpha's own cache
env:
LAKE_CONFIG: ${{ github.workspace }}/lake-cache.toml
run: |
lake cache get --scope="$CACHE_SCOPE" || echo "no existing cache to restore -- building from scratch"

- name: build PhyslibAlpha
run: |
bash -o pipefail -c "env LEAN_ABORT_ON_PANIC=1 lake build -KCI PhyslibAlpha | tee stdout.log"

# Stage the cache so it can be pushed to the bucket
- name: stage build outputs for the cache
id: stage
continue-on-error: true
run: |
set -euo pipefail
mkdir -p ../lake-cache-staging
lake build --no-build -KCI PhyslibAlpha -o .lake/outputs.jsonl
echo "mappings: $(wc -l < .lake/outputs.jsonl) entries"
lake cache stage .lake/outputs.jsonl ../lake-cache-staging
echo "staged: $(find ../lake-cache-staging -name '*.ltar' | wc -l) ltar files"

- name: publish to R2 cache
id: publish
if: steps.stage.outcome == 'success'
continue-on-error: true
env:
LAKE_CACHE_KEY_RAW: ${{ secrets.LAKE_CACHE_KEY }}
LAKE_CONFIG: ${{ github.workspace }}/lake-cache.toml
run: |
set -euo pipefail
KEY="$(printf %s "$LAKE_CACHE_KEY_RAW" | sed -e 's/[[:space:]]*$//')"
echo "::add-mask::$KEY"
export LAKE_CACHE_KEY="$KEY"

lake cache put-staged ../lake-cache-staging \
--scope="$CACHE_SCOPE" \
--rev="${{ github.sha }}"

- name: warn if cache publish failed
if: steps.stage.outcome == 'failure' || steps.publish.outcome == 'failure'
run: echo "::warning::PhyslibAlpha build cache was not published this run."
Loading
Loading