Embeddings between exact domains #
ExactMap Source Target converts exact values between the domains used by numerical families.
Binary interchange values, including Lean's native Float32 and Float, use SignedRat, which
keeps the sign of zero; posit, fixed-point, logarithmic, and quire values use Rat; OCP E8M0 uses
Dyadic; codebooks can use another exact type. The integer, rational, dyadic, and signed-rational
embeddings are defined below. Conversion lifts these finite maps over NumericalValue
observations.
The map from SignedRat to Rat preserves the rational value and forgets the sign of zero. A
conversion through Rat therefore cannot carry a source zero sign to its destination.
Instances must preserve value without rounding, overflow, or a context-dependent choice. The class cannot express that law for arbitrary source and target types, so every non-identity instance needs a separate theorem relating their mathematical interpretations. An arbitrary coercion is insufficient to define an instance.
Canonical embedding between executable exact domains.
This class is an interoperability capability, not an implicit numerical-promotion rule. User values remain statically typed, and destination rounding still occurs only in an explicit conversion or destination-driven operation. Installing an instance is a semantic commitment; preservation must be justified in the source or target domain's own mathematical model.
- map : Source → Target
Preserve the source's numerical value without rounding.
Representation metadata can be forgotten:
signedRatToRatdiscards the sign of zero. Preservation of numerical value is justified by separate domain-specific theorems.
Instances
Apply the canonical exact-domain embedding selected for these two types.
Instances For
Every exact domain embeds into itself without changing a value.
The identity exact-domain embedding is computationally the identity.
Signed integers embed exactly into rational arithmetic.
Natural numbers embed exactly into rational arithmetic.
Exact dyadic values embed into rationals through their mathematical value.
The dyadic embedding is the executable exact rational denotation.
Rationals embed into the signed-rational domain; zero receives the positive sign.
The rational embedding keeps the value and derives the sign from it.
Signed integers embed into the signed-rational domain.
The signed-integer embedding is the rational embedding of the integer.
Natural numbers embed into the signed-rational domain.
The natural-number embedding is the rational embedding of the number.
Exact dyadics embed into the signed-rational domain, keeping the sign of zero.
The dyadic embedding is the sign-preserving signed-rational denotation.
Signed rationals embed into Rat by forgetting the sign of zero.
The rational value is preserved, but the target exact domain cannot distinguish the two zero signs. A destination that needs the source zero sign must use a sign-preserving exact domain.
The signed-rational embedding into Rat is the value projection.