/-
Copyright (c) 2025 Joseph Tooby-Smith. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joseph Tooby-Smith
-/modulepublicimportPhyslib.Meta.TODO.BasicpublicimportMathlib.Analysis.InnerProductSpace.PiL2publicimportMathlib.Geometry.Manifold.Instances.Real
Space
In this module, we define the the type Space d which corresponds
to d-dimensional flat Euclidean space and prove some properties about it.
The scope of this module is to define on Space d basic instances related translations and
the metric. We do not here define the structure of a Module on Space d, as this is done in
Physlib.SpaceAndTime.Space.Module.
Physlib sits downstream of Mathlib, and above we import the necessary Mathlib modules
which contain (perhaps transitively through imports) the definitions and theorems we need.
Implementation details
The exact implementation of Space d into Physlib is discussed in numerous places
on the Lean Zulip, including:
There is a choice between defining Space d as an abbrev of EuclideanSpace ℝ (Fin d),
as a def of a type with value EuclideanSpace ℝ (Fin d) or as a structure
with a field val : Fin d → ℝ :
+---------------------------------------------------+---------+-------+-----------+
| | abbrev | def | structure |
+---------------------------------------------------+---------+-------+-----------+
| allows casting from EuclideanSpace | yes | yes | no |
| carries instances from EuclideanSpace | yes | no | no |
| requires reproving of lemmas from EuclideanSpace| no | yes | yes |
+---------------------------------------------------+---------+-------+-----------+
The structure is the most conservative choice, as everything needs redefining. However,
there is are two benefits of using it:
It allows us to be precise about the instances we define on Space d, and makes
future refactoring of those instances easier.
It allows us to give the necessary physics context to results about Space d, which
would not otherwise be possible if we reuse results from Mathlib.
In this module we give Space d the instances of a NormedAddTorsor
and a MetricSpace. These physically correspond to the statement that
you can add a vector to a point in space, and that there is a notion of distance between
points in space. This notion of distance corresponds to a choice of length unit.
In Physlib.SpaceAndTime.Space.Module we give Space d the structure of a Module
(aka vector space), a Norm and an InnerProductSpace. These require certain choices, for example
the choice of a zero in Space d.
This module structure is necessary in numerous places. For example,
the normal derivatives used by physicists ∂_x, ∂_y, ∂_z require a
module structure.
Because of this, one should be careful to avoid using the explicit zero in Space d,
or adding two Space d values together. Where possible one should use
the VAdd (EuclideanSpace ℝ (Fin d)) (Space d) instance instead.
@[expose]publicsection
A. The Space type
The type Space d is the world-volume which corresponds to
d dimensional (flat) Euclidean space with a given (but arbitrary)
choice of length unit, and a given (but arbitrary) choice of zero.
The default value of d is 3. Thus Space = Space 3
The underlying map Fin d → ℝ associated with a point in Space.