Physlib

Physlib.Units.WithDim.Analysis

A. Analysis of dimension-tagged quantities

The numerical value of `WithDim d M` identifies it with `M`. We use that explicit identification to induce a norm on the existing additive group, not to replace its addition, natural/integer scalar multiplication, or the existing `NNReal` action.

The norm measures a numerical representation in fixed units. It is not asserted to be invariant under a change of units. The coordinate equivalence is explicit: no coercion silently discards a dimension tag. No `Ring` or `Field` on a nontrivial physical dimension is introduced.

`transport` and `transportLinearMap` lift a function and its derivative between tagged coordinates. They do not assert that the function is dimensionally correct. In particular, changing the units of model parameters is a separate question. `hasFDerivAt_transport` uses the existing calculus of continuous linear equivalences.

A.1. Coordinates and the induced norm

A.2. Transport of existing functions and derivatives

13 declarations

definition

Additive equivalence WithDim(d,M)≃+M\text{WithDim}(d, M) \simeq_{+} M

For a physical dimension dd and a commutative additive monoid MM, let WithDim(d,M)\text{WithDim}(d, M) be the type of values in MM tagged with dimension dd. This definition provides the additive equivalence WithDim(d,M)≃+M\text{WithDim}(d, M) \simeq_{+} M that maps a dimension-tagged quantity to its underlying numerical value in MM.

instance

Normed additive commutative group structure on WithDim(d,M)\text{WithDim}(d, M)

For a physical dimension dd and a type MM that is a normed additive commutative group, the type WithDim(d,M)\text{WithDim}(d, M) (representing quantities of type MM tagged with dimension dd) is equipped with a normed additive commutative group structure. The norm on WithDim(d,M)\text{WithDim}(d, M) is induced from the norm on MM via the additive equivalence WithDim(d,M)≃+M\text{WithDim}(d, M) \simeq_{+} M, such that the norm of a dimension-tagged quantity is equal to the norm of its underlying numerical value in MM.

definition

Linear equivalence WithDim(d,M)≃RM\text{WithDim}(d, M) \simeq_{\mathbb{R}} M

For a physical dimension dd and a type MM equipped with the structure of an additive commutative monoid and a module over the real numbers R\mathbb{R}, let WithDim(d,M)\text{WithDim}(d, M) be the type of values in MM tagged with dimension dd. This definition provides the linear equivalence WithDim(d,M)≃RM\text{WithDim}(d, M) \simeq_{\mathbb{R}} M that maps a dimension-tagged quantity to its underlying numerical value in MM. This equivalence identifies the coordinates of the dimension-tagged quantity as being linear over dimensionless real scalars.

instance

Normed space structure on WithDim(d,M)\text{WithDim}(d, M) over R\mathbb{R}

For a physical dimension dd and a normed space MM over the real numbers R\mathbb{R}, the type WithDim(d,M)\text{WithDim}(d, M) (representing quantities of type MM tagged with dimension dd) is equipped with a normed space structure over R\mathbb{R}. This structure inherits the norm from MM such that for any x∈WithDim(d,M)x \in \text{WithDim}(d, M), its norm is ∥x∥=∥x.val∥\|x\| = \|x.\text{val}\|, where x.valx.\text{val} is the underlying numerical value in MM. This definition ensures that the norm is compatible with real scalar multiplication, satisfying the property ∥r⋅x∥=∣r∣⋅∥x∥\|r \cdot x\| = |r| \cdot \|x\| for all r∈Rr \in \mathbb{R} and x∈WithDim(d,M)x \in \text{WithDim}(d, M).

theorem

∥x∥=∥x.val∥\|x\| = \|x.\text{val}\| for dimension-tagged quantities

Let dd be a physical dimension and MM be a normed additive commutative group. For any dimension-tagged quantity xx of type WithDim(d,M)\text{WithDim}(d, M), the norm of xx is equal to the norm of its underlying numerical value x.val∈Mx.\text{val} \in M, such that ∥x∥=∥x.val∥\|x\| = \|x.\text{val}\|.

definition

Linear isometry equivalence WithDim(d,M)≃RM\text{WithDim}(d, M) \simeq_{\mathbb{R}} M

Given a physical dimension dd and a type MM that is a normed space over the real numbers R\mathbb{R}, this definition establishes a linear isometry equivalence WithDim(d,M)≃RM\text{WithDim}(d, M) \simeq_{\mathbb{R}} M. It maps a quantity xx of type MM tagged with dimension dd to its underlying numerical value in MM. This equivalence preserves the linear structure and the norm, such that for any x∈WithDim(d,M)x \in \text{WithDim}(d, M), the norm ∥x∥\|x\| is equal to the norm of its numerical value in MM.

theorem

toValueLinearIsometryEquiv(x)=x.val\text{toValueLinearIsometryEquiv}(x) = x.\text{val} for dimension-tagged quantities

For a physical dimension dd and a type MM that is a normed space over the real numbers R\mathbb{R}, let xx be an element of the dimension-tagged type WithDim(d,M)\text{WithDim}(d, M). The linear isometry equivalence toValueLinearIsometryEquiv\text{toValueLinearIsometryEquiv} from WithDim(d,M)\text{WithDim}(d, M) to MM maps xx to its underlying numerical value x.val∈Mx.\text{val} \in M, such that toValueLinearIsometryEquiv(d,M)(x)=x.val\text{toValueLinearIsometryEquiv}(d, M)(x) = x.\text{val}.

theorem

Inverse of WithDim(d,M)≃RM\text{WithDim}(d, M) \simeq_{\mathbb{R}} M maps xx to ⟨x⟩\langle x \rangle

Let dd be a physical dimension and MM be a normed space over R\mathbb{R}. The inverse of the linear isometry equivalence WithDim(d,M)≃RM\text{WithDim}(d, M) \simeq_{\mathbb{R}} M maps an element x∈Mx \in M to its dimension-tagged representation ⟨x⟩\langle x \rangle in WithDim(d,M)\text{WithDim}(d, M).

definition

Transport of a function f:M→Nf: M \to N to dimension-tagged types WithDim d M→WithDim e N\text{WithDim } d \, M \to \text{WithDim } e \, N

Given a function f:M→Nf: M \to N and physical dimensions dd and ee (within a base system BB), the transport of ff is a function from the dimension-tagged type WithDim d M\text{WithDim } d \, M to WithDim e N\text{WithDim } e \, N. It maps an element xx with dimension dd and numerical value xval∈Mx_{\text{val}} \in M to an element with dimension ee and numerical value f(xval)∈Nf(x_{\text{val}}) \in N.

theorem

Numerical Value of Transported Function: (transport d e f(x)).val=f(x.val)(\text{transport } d \, e \, f(x)).\text{val} = f(x.\text{val})

Let MM and NN be types, and let dd and ee be physical dimensions in a base system BB. For any function f:M→Nf: M \to N and any dimension-tagged quantity x∈WithDim d Mx \in \text{WithDim } d \, M, the numerical value of the quantity obtained by applying the transported function transport d e f\text{transport } d \, e \, f to xx is equal to the result of applying ff to the numerical value of xx. That is, (transport d e f(x)).val=f(x.val) (\text{transport } d \, e \, f(x)).\text{val} = f(x.\text{val}) where x.valx.\text{val} denotes the underlying numerical representation of the quantity xx.

definition

Transport of a continuous linear map f:M→Nf: M \to N to WithDim(d,M)→WithDim(e,N)\text{WithDim}(d, M) \to \text{WithDim}(e, N)

Let MM and NN be normed spaces over R\mathbb{R}, and let dd and ee be physical dimensions. Given a continuous linear map f:M→Nf: M \to N, this definition constructs a corresponding continuous linear map from WithDim(d,M)\text{WithDim}(d, M) to WithDim(e,N)\text{WithDim}(e, N). It is defined by taking a quantity x∈WithDim(d,M)x \in \text{WithDim}(d, M), extracting its underlying numerical value in MM via the canonical linear isometry vd:WithDim(d,M)≅Mv_d: \text{WithDim}(d, M) \cong M, applying ff, and then tagging the resulting value in NN with the dimension ee using the inverse isometry ve−1:N≅WithDim(e,N)v_e^{-1}: N \cong \text{WithDim}(e, N).

theorem

Numerical Value of Transported Linear Map: (transportLinearMap d e f(x)).val=f(x.val)(\text{transportLinearMap } d \, e \, f(x)).\text{val} = f(x.\text{val})

Let MM and NN be normed spaces over R\mathbb{R}, and let dd and ee be physical dimensions in a base system BB. For any continuous linear map f:M→Nf: M \to N and any dimension-tagged quantity x∈WithDim(d,M)x \in \text{WithDim}(d, M), the underlying numerical value of the result obtained by applying the transported linear map transportLinearMap(d,e,f)\text{transportLinearMap}(d, e, f) to xx is equal to the result of applying ff to the numerical value of xx. That is, (transportLinearMap(d,e,f)(x)).val=f(x.val) (\text{transportLinearMap}(d, e, f)(x)).\text{val} = f(x.\text{val}) where x.valx.\text{val} denotes the underlying numerical representation of the quantity xx in MM.

theorem

Fréchet Derivative of Transported Dimension-Tagged Functions

Let MM and NN be normed spaces over R\mathbb{R}, and let dd and ee be physical dimensions. Suppose a function f:M→Nf: M \to N has a Fréchet derivative f′f' at a point v∈Mv \in M. Then, for any dimension-tagged quantity x∈WithDim(d,M)x \in \text{WithDim}(d, M) whose underlying numerical value is vv (i.e., xval=vx_{\text{val}} = v), the transported function transport(d,e,f):WithDim(d,M)→WithDim(e,N)\text{transport}(d, e, f): \text{WithDim}(d, M) \to \text{WithDim}(e, N) has a Fréchet derivative at xx. This derivative is the transported continuous linear map transportLinearMap(d,e,f′)\text{transportLinearMap}(d, e, f').