leanprover-community / leanprover-community/physlib

Incorrect documentation of variational derivative in Euler-Lagrange equations

Open Beginner friendly
#1,534 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue help-wanted
Dominant language
Lean
Stars
750
Forks
191
Avg merge
1d 21h
Merged PRs (30d)
75

Description

⚠️ Found by a local LLM, not a human. This was flagged by an automated documentation-mistake finder (qwen3:14b) and passed 10/10 independent verification runs before filing, but it has not been reviewed by a person. Please check it's a genuine error before acting on it.


Summary

The documentation in Physlib/ClassicalMechanics/EulerLagrange.lean (around line 63) is incorrect.

Current text
- The variational derivative of `L t (q' t) (deriv q' t))` for a lagrangian `L` is equal to the `eulerLagrangeOp`.
Why this is wrong

The docstring for euler_lagrange_varGradient claims the variational derivative of L t (q' t) (deriv q' t) equals eulerLagrangeOp, but this is incorrect. The theorem actually proves that the variational derivative of the action functional — the integral of the Lagrangian over time — equals the Euler-Lagrange operator.

The confusion arises because the docstring refers to the Lagrangian itself rather than its time integral, which is the correct object whose variational derivative yields the operator. The theorem's proof and statement in the code correctly handle the action functional, not the pointwise Lagrangian value.

The correction aligns the documentation with the mathematical content of euler_lagrange_varGradient, which applies to the integral of L over time, ensuring consistency between the declaration and its formal proof.

Suggested correction
- The variational derivative of the action `∫ t, L t (q' t) (deriv q' t)` for a Lagrangian `L` is equal to the `eulerLagrangeOp`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open Physlib/ClassicalMechanics/EulerLagrange.lean around lines 63–64 and inspect the docstring for euler_lagrange_varGradient alongside its theorem statement and proof. Confirm that the variational derivative applies to the time-integrated action, then update the documentation so it describes that action rather than the pointwise Lagrangian.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.