Skip to content

Add basic formalisation of the free particle in classical mechanics#1081

Open
Pranav-Magdum wants to merge 18 commits into
leanprover-community:masterfrom
Pranav-Magdum:master
Open

Add basic formalisation of the free particle in classical mechanics#1081
Pranav-Magdum wants to merge 18 commits into
leanprover-community:masterfrom
Pranav-Magdum:master

Conversation

@Pranav-Magdum
Copy link
Copy Markdown

This PR adds a simple formalisation of the free particle: a particle of mass m with no external forces acting on it.

The goal is to capture the standard first-step reasoning from classical mechanics in Lean. Starting from Newton’s second law (m * q'' = 0), we show:

acceleration is zero,
velocity is constant,
kinetic energy is conserved.

The development is intentionally minimal and 1-dimensional (ℝ → ℝ) to keep things easy to follow. The harder analysis step (showing zero acceleration implies constant velocity) is currently isolated in a lemma, so the overall structure is clear and can be extended later.

This file introduces the FreeParticle module in classical mechanics, detailing the properties and behaviors of a free particle, including Newton's second law, constant velocity, and energy conservation.
Copy link
Copy Markdown
Member

@jstoobysmith jstoobysmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

@@ -0,0 +1,125 @@
/-
Copyright (c) 2025 Pranav Magdum. All rights reserved.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026

- Goldstein, *Classical Mechanics*

-/
import Mathlib.Data.Real.Basic
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should go before the doc-string. Also we are now using the module system (see another Physlib file as an example of how to import within the module system).


TODO "Make the documantation more descriptive"
TODO "Prove momentum conservation"
TODO "Prove the velocity_const_of_zero_acc lemma"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could make these more descriptive.

deriv q t

noncomputable
def kinetic_energy (s : FreeParticle) (q : Trajectory) (t : Time) : ℝ :=
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kineticEnergy (no underscores in names of definitions)


namespace FreeParticle

abbrev Time := ℝ
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would get this from SpaceTime.Time.Basic rather than defining it again.

Comment thread Physlib/ClassicalMechanics/FreeParticle/Basic.lean Outdated
sorry

-- Step 3: Energy conservation
theorem Energy_is_Conserved
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kineticEnergy_conserved would be a better name I think.


-- get constant velocity
rcases velocity_const_of_zero_acc q h_acc hcont with ⟨v₀, hv⟩

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we remove these new lines in the proof?

## iv. References

- Landau & Lifshitz, *Mechanics*
- Goldstein, *Classical Mechanics*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we either 1) remove these references, or 2) Add specific page numbers.


In this file, we work in a simple 1D coordinate system where position and velocity are functions
of time with values in `ℝ`. This keeps things easy to reason about. A more complete treatment would
use manifolds and tangent bundles, but that’s overkill here.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would remove the but that's overkill here.

Updated copyright year from 2025 to 2026 and modified text for clarity.
Removed references to Landau & Lifshitz and Goldstein.
Removed redundant import statements and added TODO notes for documentation and proof.
Added import for time module in FreeParticle.
Added definitions and lemmas for a classical free particle, including velocity, kinetic energy, and Newton's second law.
Updated TODO comments to specify conservation of linear momentum.
Copy link
Copy Markdown
Author

@Pranav-Magdum Pranav-Magdum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the changes according to the comments

Comment thread Physlib/ClassicalMechanics/FreeParticle/Basic.lean
Comment thread Physlib/ClassicalMechanics/FreeParticle/Basic.lean Outdated
reduces to the equation `m q'' = 0`, expressing that the acceleration
vanishes identically.
-/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this new line

Comment thread Physlib/ClassicalMechanics/FreeParticle/Basic.lean Outdated
Pranav-Magdum and others added 4 commits May 10, 2026 16:49
Co-authored-by: Joseph Tooby-Smith <72603918+jstoobysmith@users.noreply.github.com>
Added documentation for the mass parameter in FreeParticle.
Copy link
Copy Markdown
Author

@Pranav-Magdum Pranav-Magdum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made the suggested changes

@jstoobysmith
Copy link
Copy Markdown
Member

@Pranav-Magdum Thanks for fixing my comments. The linters of this are still not passing, would you mind fixing the errors there. It is possible to run the linters locally (discussed here: https://github.com/leanprover-community/physlib/blob/master/scripts/README.md), but you can also rely on the GitHub workflows.

Copy link
Copy Markdown
Author

@Pranav-Magdum Pranav-Magdum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reformatting

Comment on lines +131 to +134
intro t
have h₀ : s.mass ≠ 0 := ne_of_gt s.mass_pos
have h1 := h t
exact (mul_eq_zero.mp h1).resolve_left h₀
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These proofs should only be indented by two spaces not four. Only the theorem statement (and definition types) should be indented by four, if that makes sense. I'm happy to make this change if you would like. This is an annoying 'style' thing, which just helps with the maintainability of the code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, if you can make the change.

@jstoobysmith
Copy link
Copy Markdown
Member

@Pranav-Magdum I made some changes, I think this should pass the linters now - if it does, I will approve and merge. Many thanks for this PR! Hopefully this is the first of many :).

Copy link
Copy Markdown
Member

@jstoobysmith jstoobysmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@jstoobysmith jstoobysmith added the ready-to-merge This PR is approved and will be merged shortly label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR is approved and will be merged shortly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants