Documentation

LeanPool.BeyondBethe.BeyondBethe.MachineDyadicFloor

Polynomial-time dyadic floor #

The precision is represented by a unary ruler: its value is the ruler's length. This is essential for an honest FP statement, since a dyadic output with denominator 2^p has p + 1 denominator bits. The machine shifts the absolute numerator by the ruler length, performs verified long division, and implements Euclidean flooring explicitly for negative inputs.

Extracts the unary precision ruler from a dyadic-rounding request.

Equations
Instances For

    Extracts the raw rational code from a dyadic-rounding request.

    Equations
    Instances For

      Extracts the signed numerator code from the raw rational payload of a dyadic-rounding request.

      Equations
      Instances For

        Extracts the denominator bits from the raw rational payload of a dyadic-rounding request.

        Equations
        Instances For

          Reads the sign bit of the encoded numerator in a dyadic-rounding request.

          Equations
          Instances For

            Computes the binary absolute value of the numerator in a dyadic-rounding request.

            Equations
            Instances For

              Builds a zero-bit word whose length equals the requested unary precision.

              Equations
              Instances For

                Scales the numerator magnitude by the requested power of two using leading low-order zero bits, preserving the empty zero encoding.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Divides the scaled numerator magnitude by the denominator and returns the encoded quotient-remainder pair.

                  Equations
                  Instances For

                    Extracts the binary quotient from scaled numerator division.

                    Equations
                    Instances For

                      Extracts the binary remainder from scaled numerator division.

                      Equations
                      Instances For

                        Uses the quotient magnitude for exact negative division and its successor when a nonzero remainder requires rounding downward.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Selects the adjusted negative magnitude or ordinary quotient according to the numerator sign.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Combines the original numerator sign and the selected floor magnitude into a canonical integer code.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Encodes the denominator 2^p as p low-order zero bits followed by one.

                              Equations
                              Instances For

                                Computes the integer floor of the scaled raw rational using binary long division, increasing the negative magnitude when the remainder is nonzero.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  Pairs the binary-computed floor of 2^p * q with the positive denominator 2^p.

                                  Equations
                                  Instances For