TorchLean API

FloatLib.Floats.Formats.Posit.Semantics.Projective

Optional projective semantics of posits #

The primary posit semantics remains NumericalValue Rat: every ordinary word denotes an exact dyadic rational, while the single NaR word denotes ExceptionalValue.notAReal.

For applications that intentionally want a one-point completion, Model.toProjectiveRat is Option.toOnePoint applied to the exact optional semantics: it maps all finite values to their canonical rational point and NaR to the added point. The theorem toProjectiveRat_eq_infty_iff identifies NaR exactly; it remains distinct from every finite point. Mathlib supplies the canonical equivalence from OnePoint Rat to the projective line over Rat.

Finite rational values map canonically into OnePoint Real and the real projective line. This adapter provides coordinates for topology and projective proofs. It does not change the arithmetic interpretation of NaR.

References #

@[inline]

Intentional one-point projection of posit meanings.

It sends NaR to the added point called by OnePoint, distinct from all finite values. The name of that point does not give NaR an ordered or signed-infinity interpretation.

Instances For
    @[simp]

    The rational one-point projection sends the canonical zero word to zero.

    @[simp]

    The rational one-point projection sends the unique NaR word to its added point.

    theorem FloatLib.Floats.Formats.Posit.Model.toProjectiveRat_eq_coe_iff {format : Format} (value : Model format) (rational : ) :
    value.toProjectiveRat = rational value.toRat? = some rational

    The one-point projection agrees with the exact rational view on every ordinary posit.

    Together with toProjectiveRat_eq_infty_iff, this characterizes the complete projection: finite points correspond exactly to some rational, and the added point corresponds exactly to NaR.

    The projective view reaches its added point exactly for the NaR encoding.

    @[inline]

    Canonical rational projective-line point associated with the rational one-point view.

    Instances For

      Rational projective-line point chosen for NaR by the one-point view.

      Instances For
        @[simp]

        The rational projective-line projection sends the canonical zero word to zero.

        @[simp]

        The rational projective-line projection sends NaR to its distinguished added point.

        Equality of finite projective-line points is exactly equality of their rational coordinates.

        The equivalence is inherited from mathlib's OnePoint.equivProjectivization; no separate posit notion of projective equality is introduced.

        The rational projective-line view is its NaR point exactly for the NaR encoding.

        Mathlib real and real-projective views #

        @[inline]
        noncomputable def FloatLib.Floats.Formats.Posit.Model.toProjectiveReal {format : Format} (value : Model format) :

        Intentional real one-point projection of posit meanings.

        The finite branch is the canonical injection RatReal; NaR alone maps to the added point. This view is useful for topology and analysis. Its type distinguishes this geometric interpretation from the notAReal exception used by decodeReal.

        Instances For
          @[simp]

          The real one-point projection sends the canonical zero word to zero.

          @[simp]

          The real one-point projection sends the unique NaR word to its added point.

          theorem FloatLib.Floats.Formats.Posit.Model.toProjectiveReal_eq_coe_iff {format : Format} (value : Model format) (rational : ) :
          value.toProjectiveReal = rational value.toRat? = some rational

          A finite rational coordinate is preserved exactly by the real one-point projection.

          The real one-point projection reaches its added point exactly for NaR.

          @[inline]

          Canonical real projective-line point associated with the real one-point view.

          Instances For

            Real projective-line point chosen for NaR by the one-point view.

            Instances For
              @[simp]

              The real projective-line projection sends the canonical zero word to zero.

              @[simp]

              The real projective-line projection sends NaR to its distinguished added point.

              Finite real projective coordinates agree exactly with the embedded rational semantics.

              The real projective-line view is its NaR point exactly for the NaR encoding.