feat(ClassicalMechanics): the simple pendulum's dynamics, Lagrangian and equation of motion - #1564
feat(ClassicalMechanics): the simple pendulum's dynamics, Lagrangian and equation of motion#1564aadarwal wants to merge 14 commits into
Conversation
…dentification with the circle Add `SimplePendulum.ConfigurationSpace`, the configuration space of the planar simple pendulum as an angle modulo `2π`, with its topology, `angleHomeomorph : ConfigurationSpace ≃ₜ Real.Angle`, `circleHomeomorph : ConfigurationSpace ≃ₜ Circle`, and the induced `T2Space`, `CompactSpace` and `SecondCountableTopology` instances. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…urationSpace Add `ConfigurationSpace.instChartedSpace`, whose atlas is the atlas of the unit circle pulled back along `circleHomeomorph`, `chartAt_eq`, and `ConfigurationSpace.instIsManifold : IsManifold (𝓡 1) ω`, obtained from the analytic manifold structure of `Circle`. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…of the pendulum configuration space Add `ConfigurationSpace.ofAngle : ℝ → ConfigurationSpace` with `ofAngle_periodic`, `ofAngle_eq_iff`, `ofAngle_surjective`, `continuous_ofAngle`, `toCircle_ofAngle`; the angle functions `cos`, `sin` with `cos_sq_add_sin_sq`; and the position map `toSpace ℓ : ConfigurationSpace → Space 2` with `toSpace_ofAngle`, `toSpace_ofAngle_zero`, the rod-length constraint `toSpace_norm`, `continuous_toSpace` and `toSpace_injective`. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…rover-community#883 manifold and Space-map requirements done Add Physlib/ClassicalMechanics/Pendulum/SimplePendulum/API-map.yaml and record in the pendulum configuration-space map that the manifold structure and the map into `Space` are now provided by `SimplePendulum.ConfigurationSpace`. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…onSpace Fix the pendulum API-map overview that contradicted its requirement rows, make the documentation claim only what is proved (configuration, covering map, `lies on the circle`), and add the small API the review asked for: `isCoveringMap_ofAngle`, `toSpace_isClosedEmbedding`, `continuous_cos`, `continuous_sin` (`@[fun_prop]`), `ofCircle` with its round-trip lemmas, `chartAt_source`, `chartAt_target`, `cos_angle`, `sin_angle`; state `toSpace_apply_one` in simp-normal form and use `Real.Angle.cos_sin_inj` in `toSpace_injective`. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…or the pendulum configuration space Say "covering map" (not "universal cover") and "configuration" (not "motion") where only those are proved; list `isCoveringMap_ofAngle`, `toSpace_isClosedEmbedding`, `ofCircle` and the chart source/target lemmas among the key results; add `@[simp] ofCircle_circleExp`. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
… special case Per review: with toSpace_ofAngle as a simp lemma, the theta = 0 position follows by simp via Real.sin_zero and Real.cos_zero, so the special-case lemma is redundant. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…' into pr2a-newbase
…ia and energies Add `SimplePendulum` (mass `m`, rod length `ℓ`, gravity `g`), the angular frequency `ω = √(g/ℓ)` with `ω_pos`, `ω_sq`, `inverse_ω_sq`, the moment of inertia `inertia = m ℓ²` with `ω_sq_mul_inertia`, the energies `kineticEnergy`, `potentialEnergy = m g ℓ (1 − cos θ)`, `energy` with their bounds (`potentialEnergy_nonneg`, `potentialEnergy_le`, `potentialEnergy_eq_zero_iff`), smoothness, `gradient_potentialEnergy`, and the time derivatives `kineticEnergy_deriv`, `potentialEnergy_deriv`, `energy_deriv`. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
…quation of motion Add `SimplePendulum.lagrangian` with its equalities, smoothness and gradients, the generalized force `torque = -∇V` with `torque_eq`/`torque_apply`, the pointwise equation of motion `EquationOfMotion : ∀ t, I • θ̈ t = torque (θ t)` together with `IsSolution` (smooth solutions), the scalar form `equationOfMotion_iff_scalar : θ̈ + ω² sin θ = 0`, mass independence `equationOfMotion_iff_of_eq_ω`, and the variational derivative `gradLagrangian` with `gradLagrangian_eq_eulerLagrangeOp` and `gradLagrangian_eq_torque`. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
…ation of motion State accurately that the time derivative is itself totalized and why that cannot make the pointwise equation vacuously true, instead of the previous wording that read as a false claim. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
…_comp_coord The cosine-potential gradient is now the one-line specialization of the shared chain rule `gradient_comp_coord`, instead of a local proof. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
… simple pendulum Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Codex GPT-5.6 <noreply@openai.com>
|
Thank you for this pull-request (PR). If this is your first PR, welcome to the community! Below is what will happen next. Please read carefully if you are not familiar with the process. You may open other PRs while this one is being reviewed, and can stack PRs on top of each other, so don't let these steps slow you down.
Tip: The easiest way to get have a fast review is to submit a PR that is small and self-contained, and has clear documentation explaining why things are the way they are in your chages. If you have any problems or questions, please reach out to the community on the Zulip. |
|
Would you be able to rebase this branch with your earlier merged PR so that it is a bit easier to see the changes |
Toward #883. Second of the series (after #1560, merged, and #1561).
Stacked on #1561. This branch contains #1561's commits underneath it (the dynamics import the
configuration-space API map). The commits belonging to this PR are the last six
(
5114c9df..b0965d2a); the diff cleans itself once #1561 merges and this branch is rebased.Adds
Physlib/ClassicalMechanics/Pendulum/SimplePendulum/Basic.lean: the input data of the simple gravity pendulum, its energies, its Lagrangian, the torque of gravity, and the equation of motionI θ̈ = τ(θ)with its scalar formθ̈ + (g/ℓ) sin θ = 0. The dynamics are written on the Euclidean liftTime → EuclideanSpace ℝ (Fin 1), exactly asHarmonicOscillator/Basic.leandoes; the geometric configuration space added in #1561 is connected to it in a later PR.Size. 754 added lines in
Basic.lean, of which 434 are documentation (335 module-doc and section prose, 99 docstrings) and ~236 are non-blank Lean. For comparison,HarmonicOscillator/Basic.leanis 756 lines with the same section structure. The two feature commits are separable —5114c9dfis sections A–C (data, frequency, inertia, energies) andccce411dis D–F (Lagrangian, torque, equation of motion) — and I am happy to split this into two PRs at that boundary if you would prefer to review it that way.One design choice worth flagging. The equation of motion is defined as the pointwise relation
∀ t, I • θ̈ t = τ(θ t), followingDampedHarmonicOscillator/Basic.lean, rather than as the vanishing of the variational derivative as inHarmonicOscillator/Basic.lean.varGradientis defined to be0when no variational gradient exists, so its vanishing holds for every lift too rough to admit one; the pointwise form is totalized too, but its totalization hands a rough liftθ̈ = 0and leaves a genuine, generally false constraint rather than a vacuous truth. The two agree for smooth lifts; that equivalence, and energy conservation, come in the follow-up PR.IsSolution θ := ContDiff ℝ ∞ θ ∧ EquationOfMotion θis the public notion of a solution, and excludes the piecewise-equilibrium functions that the bare pointwise equation admits.Reviewer reading order
ω,inertia, and the energies.ω_sq_mul_inertiais the identity that cancels the mass;gradient_potentialEnergyis the only real calculus in the section.SimplePendulum/API-map.yamland the one-line addition toPhyslib.lean.Declarations added
All in
Physlib/ClassicalMechanics/Pendulum/SimplePendulum/Basic.lean, namespaceClassicalMechanics.SimplePendulum.SimplePendulumm, rod lengthℓ, gravityg, all positivem_ne_zero,ℓ_ne_zero,g_ne_zero@[simp]non-vanishing, the form the field-clearing tactics consumeω√(g/ℓ)of the small oscillationsω_pos,ω_ne_zero,ω_sq,inverse_ω_sqω² = g/ℓ,(ω²)⁻¹ = ℓ/ginertiam ℓ²about the pivotinertia_pos,inertia_ne_zeroω_sq_mul_inertiaω² I = m g ℓ— the identity by which the mass cancelskineticEnergy,potentialEnergy,energy½ I θ̇²,m g ℓ (1 − cos θ), and their sumkineticEnergy_eq,potentialEnergy_eq,energy_eqpotentialEnergy_nonneg,potentialEnergy_le,potentialEnergy_eq_zero_iff0 ≤ V ≤ 2 m g ℓ, andV = 0 ↔ cos θ = 1potentialEnergy_contDiff,differentiable_potentialEnergyVas a function of the anglegradient_potentialEnergy∇V = m g ℓ sin θ · e₀kineticEnergy_differentiable,potentialEnergy_differentiable,energy_differentiablekineticEnergy_deriv,potentialEnergy_deriv,energy_deriv⟪θ̇, ·⟫;energy_derivpairsθ̇withI θ̈ + ∇Vlagrangian,lagrangian_eq,lagrangian_eq_kineticEnergy_sub_potentialEnergyL(t,θ,θ̇) = ½ I ‖θ̇‖² − V(θ), expanded, and asT − Valong a liftcontDiff_lagrangian↿L, the Euler–Lagrange hypothesisgradient_lagrangian_position_eq,gradient_lagrangian_velocity_eq∂L/∂θ = −∇Vand∂L/∂θ̇ = I θ̇, the angular momentumtorque,torque_eq,torque_applyτ = −∇V; the generalized force conjugate to the angle,= −m g ℓ sin θEquationOfMotion∀ t, I • θ̈ t = τ(θ t)equationOfMotion_iff_newtons_2nd_lawI θ̈ + ∇V = 0), the damped oscillator's shape — the combinationenergy_derivpairs with the velocityIsSolution,IsSolution.contDiff,IsSolution.equationOfMotionequationOfMotion_iff_scalarθ̈ + ω² sin θ = 0— the mass has cancelledequationOfMotion_iff_of_eq_ωωhave the same motionsgradLagrangiangradLagrangian_eq_eulerLagrangeOpgradLagrangian_eq_torqueτ(θ) − I θ̈Also: one
public importline inPhyslib.lean, and two row updates inSimplePendulum/API-map.yaml(the Lagrangian/equation-of-motion requirement is now met; a new row records the variational equivalence and energy conservation as outstanding).Why
Pendulum/API-map.yamlis in the diff: this PR made the parent map's Overview stale, so itis amended. I read the parent's "shall subsequently contain the definition of the lagrangian" row
as the Lagrangian built on the configuration-space trajectory — still open, coming with the
geometric bridge — so I left it
done: falseand recorded the Euclidean-lift Lagrangian in theSimplePendulum map instead. Happy to flip it if you read that row differently.
Verification
lake build Physlib.ClassicalMechanics.Pendulum.SimplePendulum.Basic—lake build—lake exe runPhyslibLinters Physlib—lake exe check_file_imports—./scripts/lint-style.sh(run on committed state) —python scripts/api_map_linter.py --repo .—codespellwith the repo's.codespellignore—public importconfirmed necessary by removing it and rebuilding —Developed with assistance from AI; all mathematics and proofs were reviewed and verified to compile.