Physlib

Physlib.Units.PositiveRealUnit

A. Shared arithmetic for positive-real unit types

`PositiveRealUnitCore` records a unit magnitude and its inverse construction. Each concrete unit declares this instance explicitly and keeps its own structure. The inhabited and same-type division instances, rescaling operation, and arithmetic laws are provided generically. No command or type-specific lemma wrappers are needed.

The arithmetic is adapted from the existing unit modules by Joseph Tooby-Smith. This interface describes an individual unit type, independently of the selection and combination of units by `UnitMagnitudeCatalog` and `UnitSystem`.

A.1. Representation and instances

A.2. Unit ratios

A.3. Positive rescaling

19 declarations

instance

Default unit has magnitude 11

For a unit type UU equipped with the `PositiveRealUnitCore` structure, this instance provides a default element by defining it as the unit whose magnitude is 11.

theorem

The magnitude val(x)\text{val}(x) of a unit is non-zero.

For any unit xx of type UU, its magnitude val(x)\text{val}(x) is non-zero.

definition

Ratio of unit magnitudes val(x)/val(y)\text{val}(x) / \text{val}(y)

For two units xx and yy of the same type UU, the ratio is defined as the quotient of their magnitudes val(x)val(y)\frac{\text{val}(x)}{\text{val}(y)}, returning a non-negative real number in R≥0\mathbb{R}_{\ge 0}.

instance

Unit division x/yx / y as a ratio of magnitudes val(x)val(y)\frac{\text{val}(x)}{\text{val}(y)}

For two units xx and yy of the same type UU, the division operation x/yx / y is defined as the ratio of their magnitudes val(x)val(y)\frac{\text{val}(x)}{\text{val}(y)}, resulting in a non-negative real number in R≥0\mathbb{R}_{\ge 0}.

theorem

x/y=val(x)val(y)x / y = \frac{\text{val}(x)}{\text{val}(y)} for units x,yx, y

For any two units xx and yy belonging to a unit type UU defined under `PositiveRealUnitCore`, the result of the division x/yx / y is equal to the ratio of their magnitudes val(x)val(y)\frac{\text{val}(x)}{\text{val}(y)}, represented as a non-negative real number in R≥0\mathbb{R}_{\ge 0}.

theorem

The ratio of two units x/yx / y is strictly positive (x/y>0x / y > 0)

For any two units xx and yy of a positive real unit type UU, the ratio x/yx / y is strictly greater than 00 in the set of non-negative real numbers R≥0\mathbb{R}_{\ge 0}.

theorem

The ratio x/y≠0x / y \neq 0 for units x,yx, y in UU

For any two units xx and yy belonging to a positive real unit type UU, the ratio x/yx / y is not equal to 00 in the set of non-negative real numbers R≥0\mathbb{R}_{\ge 0}.

theorem

x/x=1x / x = 1 for any unit xx

For any unit xx of type UU, the ratio of the unit with itself is equal to the non-negative real number 11, i.e., x/x=1x / x = 1.

theorem

x/y=(y/x)−1x / y = (y / x)^{-1} for Unit Ratios

For any two units xx and yy of the same unit type UU, the ratio of their magnitudes x/yx / y is equal to the multiplicative inverse of the ratio y/xy / x in the non-negative real numbers R≥0\mathbb{R}_{\ge 0}, such that x/y=(y/x)−1x / y = (y / x)^{-1}.

theorem

(x/y)⋅(y/z)=x/z(x / y) \cdot (y / z) = x / z for unit ratios

For any units x,y,x, y, and zz of the same positive-real unit type UU, the product of the ratio of xx to yy and the ratio of yy to zz is equal to the ratio of xx to zz in the non-negative real numbers R≥0\mathbb{R}_{\ge 0}. That is: (x/y)⋅(y/z)=x/z(x / y) \cdot (y / z) = x / z where x/yx / y denotes the ratio of the magnitudes of units xx and yy.

theorem

(x/y)⋅(y/z)=x/z(x / y) \cdot (y / z) = x / z for unit ratios in R\mathbb{R}

Let UU be a positive-real unit type. For any units x,y,z∈Ux, y, z \in U, the product of the ratio of xx to yy and the ratio of yy to zz is equal to the ratio of xx to zz, where these ratios are treated as real numbers: (x/y)⋅(y/z)=x/z(x / y) \cdot (y / z) = x / z

theorem

val(scale r x)=r⋅val(x)\text{val}(\text{scale } r \text{ } x) = r \cdot \text{val}(x)

Let UU be a positive-real unit type. For any unit x∈Ux \in U, any real number r∈Rr \in \mathbb{R}, and a proof hrh_r that r>0r > 0, the numerical magnitude of the rescaled unit is given by the product of the scalar and the original magnitude: val(scale(r,x,hr))=r⋅val(x)\text{val}(\text{scale}(r, x, h_r)) = r \cdot \text{val}(x).

theorem

val(x)=val(y)  ⟹  x=y\text{val}(x) = \text{val}(y) \implies x = y for units

Let UU be a positive-real unit type. For any two units x,y∈Ux, y \in U, if their numerical magnitudes are equal, denoted by val(x)=val(y)\text{val}(x) = \text{val}(y), then the units themselves are equal, x=yx = y.

theorem

(scale(r,x))/x=r(\text{scale}(r, x)) / x = r for units

Let UU be a positive-real unit type. For any unit x∈Ux \in U and any real number r>0r > 0, the ratio of the rescaled unit to the original unit is equal to the scaling factor rr, expressed as scale(r,x)x=r\frac{\text{scale}(r, x)}{x} = r. Here, the division of units of the same type results in a non-negative real number in R≥0\mathbb{R}_{\ge 0}.

theorem

x/scale(r,x)=1/rx / \text{scale}(r, x) = 1/r

For any unit xx of a positive-real unit type UU and any positive real number r>0r > 0, the ratio of the unit xx to the unit rescaled by rr is equal to the reciprocal of the scaling factor, i.e., x/scale(r,x)=1/rx / \text{scale}(r, x) = 1/r. Here, the division x/yx / y represents the ratio of the magnitudes of the units in the non-negative real numbers R≥0\mathbb{R}_{\ge 0}.

theorem

Scaling a unit by 1 is the identity operation (scale(1,x)=x\text{scale}(1, x) = x)

For any unit xx of type UU within the `PositiveRealUnitCore` framework, scaling xx by the real number 11 leaves the unit unchanged, i.e., scale(1,x)=x\text{scale}(1, x) = x.

theorem

scale(r1,x1)scale(r2,x2)=r1r2⋅x1x2\frac{\text{scale}(r_1, x_1)}{\text{scale}(r_2, x_2)} = \frac{r_1}{r_2} \cdot \frac{x_1}{x_2}

For any units x1,x2x_1, x_2 of type UU and any positive real numbers r1,r2>0r_1, r_2 > 0, rescaling these units by the factors r1r_1 and r2r_2 respectively results in a ratio equal to the ratio of the factors multiplied by the ratio of the original units: scale(r1,x1)scale(r2,x2)=r1r2⋅x1x2\frac{\text{scale}(r_1, x_1)}{\text{scale}(r_2, x_2)} = \frac{r_1}{r_2} \cdot \frac{x_1}{x_2} where x/yx / y denotes the ratio of the magnitudes of the units.

theorem

scale(r1,scale(r2,x))=scale(r1⋅r2,x)\text{scale}(r_1, \text{scale}(r_2, x)) = \text{scale}(r_1 \cdot r_2, x)

For any unit magnitude xx and any positive real numbers r1,r2>0r_1, r_2 > 0, successive rescalings compose by multiplication of their factors. Specifically, scaling the unit xx by r2r_2 and then scaling the resulting unit by r1r_1 is equivalent to scaling the original unit xx by the product r1⋅r2r_1 \cdot r_2, denoted as scale(r1,scale(r2,x))=scale(r1⋅r2,x)\text{scale}(r_1, \text{scale}(r_2, x)) = \text{scale}(r_1 \cdot r_2, x).

theorem

scale(y/x,x)=y\text{scale}(y / x, x) = y

For any two units xx and yy of the same type UU, if the ratio y/xy / x is a positive real number, then scaling the unit xx by the factor y/xy / x results in the unit yy. In mathematical terms, this is expressed as scale(y/x,x)=y\text{scale}(y / x, x) = y.