Physlib

Physlib.SpaceAndTime.Space.Basic

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:

  • https://leanprover.zulipchat.com/#narrow/channel/479953-Physlib/topic/Space.20vs.20EuclideanSpace/with/575332888

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:

1. It allows us to be precise about the instances we define on `Space d`, and makes future refactoring of those instances easier. 2. 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.

A. The `Space` type

B. Instances on `Space`

B.1. Instance of coercion to functions

B.2. The Non-emptiness

B.3.1. The additive action

B.3.2. Subtraction

B.3.3. AddTorsor instance

B.4. PseudoMetricSpace

B.5. NormAddTorsor instance

B.6. Metric space instance

B.7. Non-trivality

C. Model structure (i.e. structure of a manifold)

23 declarations

theorem

p=q    p.val=q.valp = q \iff p.\text{val} = q.\text{val}

For any dimension dd, let pp and qq be points in the dd-dimensional flat Euclidean space Space d\text{Space } d. Let p.valp.\text{val} and q.valq.\text{val} denote their underlying coordinate representations (of type Fin dR\text{Fin } d \to \mathbb{R}). Then, the two points are equal if and only if their coordinate representations are equal, that is, p=q    p.val=q.valp = q \iff p.\text{val} = q.\text{val}.

instance

Function coercion for Space d\text{Space } d to Fin dR\text{Fin } d \to \mathbb{R}

For any dimension dd, an element pp of the dd-dimensional flat Euclidean space Space d\text{Space } d can be treated as a function mapping an index i{0,,d1}i \in \{0, \dots, d-1\} to a real number piRp_i \in \mathbb{R}. This coercion allows a point in space to be evaluated at a specific coordinate index to retrieve its value.

instance

Space d\text{Space } d is non-empty

For any dimension dd, the dd-dimensional flat Euclidean space Space d\text{Space } d is non-empty.

instance

Space 0\text{Space } 0 is a subsingleton

The 00-dimensional flat Euclidean space Space 0\text{Space } 0 is a subsingleton. That is, for any two points s1,s2Space 0s_1, s_2 \in \text{Space } 0, it holds that s1=s2s_1 = s_2.

instance

Additive action of EuclideanSpace Rd\text{EuclideanSpace } \mathbb{R}^d on Space d\text{Space } d

This instance defines the additive action of the Euclidean vector space Rd\mathbb{R}^d (modeled as `EuclideanSpace ℝ (Fin d)`) on the dd-dimensional flat Euclidean space Space d\text{Space } d. For a vector vEuclideanSpace Rdv \in \text{EuclideanSpace } \mathbb{R}^d and a point sSpace ds \in \text{Space } d, the translation v+vsv +_{\text{v}} s results in a point whose coordinates are the sum of the components of vv and the coordinates of ss, specifically (v+vs)i=vi+si(v +_{\text{v}} s)_i = v_i + s_i for each index i{0,,d1}i \in \{0, \dots, d-1\}.

theorem

Coordinate Components of Translation in Space d\text{Space } d: (v+vs)i=vi+si(v +_{\text{v}} s)_i = v_i + s_i

In dd-dimensional flat Euclidean space (Space d\text{Space } d), let vv be a vector in Rd\mathbb{R}^d (modeled as `EuclideanSpace ℝ (Fin d)`) and ss be a point in Space d\text{Space } d. The coordinate representation of the point v+vsv +_{\text{v}} s, which is the result of translating ss by vv, is the component-wise sum of the coordinates of vv and ss. That is, for every index i{0,,d1}i \in \{0, \dots, d-1\}, (v+vs)i=vi+si(v +_{\text{v}} s)_i = v_i + s_i.

theorem

(v+vs)i=vi+si(v +_{\text{v}} s)_i = v_i + s_i in Space d\text{Space } d

In a dd-dimensional flat Euclidean space (Space d\text{Space } d), let vv be a vector in Rd\mathbb{R}^d (represented by `EuclideanSpace ℝ (Fin d)`) and ss be a point in Space d\text{Space } d. For any coordinate index i{0,,d1}i \in \{0, \dots, d-1\}, the ii-th component of the point resulting from the translation of ss by vv (denoted v+vsv +_{\text{v}} s) is equal to the sum of the ii-th component of vv and the ii-th component of ss. That is, (v+vs)i=vi+si(v +_{\text{v}} s)_i = v_i + s_i.

theorem

Transitivity of translation in Space d\text{Space } d: v,v+vs1=s2\exists v, v +_{\text{v}} s_1 = s_2

In dd-dimensional flat Euclidean space (Space d\text{Space } d), for any two points s1,s2Space ds_1, s_2 \in \text{Space } d, there exists a vector vv in the Euclidean vector space Rd\mathbb{R}^d (represented by `EuclideanSpace ℝ (Fin d)`) such that translating s1s_1 by vv results in s2s_2, denoted by v+vs1=s2v +_{\text{v}} s_1 = s_2.

instance

Additive action of Rd\mathbb{R}^d on Space d\text{Space } d

This instance defines the additive action of the dd-dimensional Euclidean vector space Rd\mathbb{R}^d (represented by `EuclideanSpace ℝ (Fin d)`) on the flat Euclidean space Space d\text{Space } d. This action represents translation, ensuring that for any point sSpace ds \in \text{Space } d and any vectors v,v1,v2Rdv, v_1, v_2 \in \mathbb{R}^d, the following axioms of an additive group action are satisfied: 1. The zero vector acts as the identity: 0+vs=s0 +_{\text{v}} s = s. 2. The action is compatible with vector addition: (v1+v2)+vs=v1+v(v2+vs)(v_1 + v_2) +_{\text{v}} s = v_1 +_{\text{v}} (v_2 +_{\text{v}} s).

instance

Vector subtraction in dd-dimensional space

For a dd-dimensional flat Euclidean space Space d\text{Space } d, this definition provides the vector subtraction (displacement) operation \ominus (represented by the `VSub` typeclass). Given two points s1,s2Space ds_1, s_2 \in \text{Space } d, the result s1vs2s_1 -_v s_2 is a displacement vector in the Euclidean space Rd\mathbb{R}^d (specifically `EuclideanSpace ℝ (Fin d)` with the L2L^2 norm) whose components are defined by (s1vs2)i=s1(i)s2(i)(s_1 -_v s_2)_i = s_1(i) - s_2(i) for each coordinate index i{0,,d1}i \in \{0, \dots, d-1\}.

theorem

(s1vs2)i=s1(i)s2(i)(s_1 -_v s_2)_i = s_1(i) - s_2(i) in dd-dimensional space

In the dd-dimensional flat Euclidean space Space d\text{Space } d, for any two points s1,s2Space ds_1, s_2 \in \text{Space } d and any coordinate index i{0,,d1}i \in \{0, \dots, d-1\}, the ii-th component of the displacement vector s1vs2s_1 -_v s_2 is equal to the difference between the ii-th coordinates of s1s_1 and s2s_2: (s1vs2)i=s1(i)s2(i)(s_1 -_v s_2)_i = s_1(i) - s_2(i) Here, the subtraction s1vs2s_1 -_v s_2 (provided by the `VSub` instance) represents the vector in Rd\mathbb{R}^d pointing from s2s_2 to s1s_1.

instance

Space d\text{Space } d is an affine space modeled on Rd\mathbb{R}^d

The dd-dimensional flat Euclidean space Space d\text{Space } d is an additive torsor (or affine space) modeled on the Euclidean vector space Rd\mathbb{R}^d (specifically `EuclideanSpace ℝ (Fin d)`). This structure provides a free and transitive additive action of vectors in Rd\mathbb{R}^d on points in Space d\text{Space } d, representing translations. It ensures that for any points s1,s2,sSpace ds_1, s_2, s \in \text{Space } d and any vector vRdv \in \mathbb{R}^d, the following identities hold: 1. (s1vs2)+vs2=s1(s_1 -_v s_2) +_v s_2 = s_1 2. (v+vs)vs=v(v +_v s) -_v s = v where +v+_v denotes the translation of a point by a vector and v-_v denotes the displacement vector between two points.

instance

Distance on Space d\text{Space } d

For any two points p,qp, q in the dd-dimensional flat Euclidean space Space d\text{Space } d, the distance function dist(p,q)\text{dist}(p, q) is defined as the Euclidean distance: dist(p,q)=i=0d1(piqi)2\text{dist}(p, q) = \sqrt{\sum_{i=0}^{d-1} (p_i - q_i)^2} where pip_i and qiq_i denote the ii-th coordinates of the points pp and qq respectively.

theorem

dist(p,q)=i(piqi)2\text{dist}(p, q) = \sqrt{\sum_i (p_i - q_i)^2} in Space d\text{Space } d

For any two points pp and qq in the dd-dimensional flat Euclidean space Space d\text{Space } d, the distance between them is given by the square root of the sum of the squared differences of their coordinates: dist(p,q)=i(piqi)2\text{dist}(p, q) = \sqrt{\sum_{i} (p_i - q_i)^2} where pip_i and qiq_i denote the ii-th coordinates of the points pp and qq respectively, and the sum ranges over all indices i{0,,d1}i \in \{0, \dots, d-1\}.

instance

Pseudo-metric space structure on Space d\text{Space } d

The dd-dimensional flat Euclidean space Space d\text{Space } d is equipped with a pseudo-metric space structure. The distance between any two points p,qSpace dp, q \in \text{Space } d is defined by the Euclidean metric: dist(p,q)=i=0d1(piqi)2\text{dist}(p, q) = \sqrt{\sum_{i=0}^{d-1} (p_i - q_i)^2} This structure satisfies the axioms of a pseudo-metric space, including the property that dist(p,p)=0\text{dist}(p, p) = 0, symmetry dist(p,q)=dist(q,p)\text{dist}(p, q) = \text{dist}(q, p), and the triangle inequality dist(p,r)dist(p,q)+dist(q,r)\text{dist}(p, r) \leq \text{dist}(p, q) + \text{dist}(q, r).

instance

Space d\text{Space } d is a normed affine space modeled on Rd\mathbb{R}^d

The dd-dimensional flat Euclidean space Space d\text{Space } d is a normed additive torsor (or normed affine space) modeled on the Euclidean vector space Rd\mathbb{R}^d (specifically `EuclideanSpace ℝ (Fin d)`). This structure identifies the distance between any two points p,qSpace dp, q \in \text{Space } d with the Euclidean norm of their displacement vector pqRdp - q \in \mathbb{R}^d: dist(p,q)=pq\text{dist}(p, q) = \|p - q\| where \|\cdot\| denotes the standard Euclidean norm pi2\sqrt{\sum p_i^2}.

instance

Metric space structure on Space d\text{Space } d

The dd-dimensional flat Euclidean space Space d\text{Space } d is equipped with a metric space structure. This structure defines a distance function dist(p,q)\text{dist}(p, q) for any two points p,qSpace dp, q \in \text{Space } d using the standard Euclidean metric: dist(p,q)=i=0d1(piqi)2\text{dist}(p, q) = \sqrt{\sum_{i=0}^{d-1} (p_i - q_i)^2} As a metric space, it satisfies the identity of indiscernibles, meaning that dist(p,q)=0\text{dist}(p, q) = 0 if and only if p=qp = q, in addition to the properties of a pseudo-metric space (symmetry and the triangle inequality).

instance

Space(d+1)\text{Space}(d+1) is Nontrivial

For any natural number dd, the (d+1)(d+1)-dimensional flat Euclidean space Space(d+1)\text{Space}(d+1) is nontrivial, meaning it contains at least two distinct points.

definition

Manifold structure on Space d\text{Space } d

The manifold structure on the dd-dimensional flat Euclidean space Space d\text{Space } d is established by modeling it on the Euclidean vector space Rd\mathbb{R}^d. This structure is defined via a global coordinate chart that identifies the affine space Space d\text{Space } d with Rd\mathbb{R}^d by choosing an arbitrary origin p0Space dp_0 \in \text{Space } d and mapping each point sSpace ds \in \text{Space } d to the displacement vector sp0Rds - p_0 \in \mathbb{R}^d.

theorem

The composition of the manifold structure map and its inverse on Space d\text{Space } d is the identity function

For any natural number dd, let II be the map defining the manifold structure on the dd-dimensional flat Euclidean space Space d\text{Space } d, which identifies it with the model space Rd\mathbb{R}^d. The composition of II and its inverse I1I^{-1} is the identity function on Rd\mathbb{R}^d, i.e., II1=idI \circ I^{-1} = \text{id}.

theorem

ϕ(ϕ1(x))=x\phi(\phi^{-1}(x)) = x for the manifold structure of Space d\text{Space } d

Let ϕ\phi be the manifold structure map (the global coordinate chart) that identifies the dd-dimensional flat Euclidean space Space d\text{Space } d with the Euclidean vector space Rd\mathbb{R}^d. For any vector xRdx \in \mathbb{R}^d, applying the map ϕ\phi to the image of xx under the inverse mapping ϕ1\phi^{-1} returns the original vector xx: ϕ(ϕ1(x))=x\phi(\phi^{-1}(x)) = x

theorem

The range of the manifold structure map on Space d\text{Space } d is Rd\mathbb{R}^d

Let II be the map defining the manifold structure on the dd-dimensional flat Euclidean space Space d\text{Space } d, which identifies it with the Euclidean model space Rd\mathbb{R}^d. The range of II is the entire model space Rd\mathbb{R}^d: range(I)=Rd\text{range}(I) = \mathbb{R}^d

theorem

The coordinate chart of Space d\text{Space } d is CC^\infty

For any natural number dd, the map ϕ:Space dRd\phi: \text{Space } d \to \mathbb{R}^d that defines the manifold structure on the dd-dimensional flat Euclidean space is infinitely differentiable, i.e., it is of class CC^\infty. This map ϕ\phi corresponds to the global coordinate chart that identifies points in the space with their coordinates in the model Euclidean vector space Rd\mathbb{R}^d.