Documentation

Interval.Approx.Approx

Approximate arithmetic typeclasses #

class Approx (A R : Type) :

A approximates R, in that we know which Rs an A corresponds to.

  • approx (x : A) (y : R) : Prop
Instances
    class ApproxZero (A R : Type) [Zero R] [Zero A] [Approx A R] :

    0 : A is conservative, and 0 only approximates 0

    Instances
      class ApproxZeroIff (A R : Type) [Zero R] [Zero A] [Approx A R] :

      0 : A only approximates 0

      • approx_zero_imp (x : R) : approx 0 xx = 0
      Instances
        class ApproxOne (A R : Type) [One R] [One A] [Approx A R] :

        1 : A is conservative

        Instances
          class ApproxNeg (A R : Type) [Neg R] [Neg A] [Approx A R] :

          -A is conservative

          Instances
            class ApproxAdd (A R : Type) [Add R] [Add A] [Approx A R] :

            A + A is conservative

            Instances
              class ApproxSub (A R : Type) [Sub R] [Sub A] [Approx A R] :

              A - A is conservative

              Instances
                class ApproxMul (A R : Type) [Mul R] [Mul A] [Approx A R] :

                A * A is conservative

                Instances
                  class ApproxInv (A R : Type) [Inv R] [Inv A] [Approx A R] :

                  A⁻¹ is conservative

                  Instances
                    class ApproxStar (A R : Type) [Star R] [Star A] [Approx A R] :

                    star A is conservative

                    Instances
                      class ApproxDiv (A R : Type) [Div R] [Div A] [Approx A R] :

                      A / A is conservative

                      Instances
                        class ApproxSMul (A B A' B' : Type) [SMul A B] [SMul A' B'] [Approx A A'] [Approx B B'] :

                        A • B is conservative

                        Instances
                          class ApproxNatCast (A R : Type) [NatCast R] [NatCast A] [Approx A R] :

                          A has conservative conversion

                          Instances
                            class ApproxIntCast (A R : Type) [IntCast R] [IntCast A] [Approx A R] :

                            A has conservative conversion

                            Instances
                              class ApproxRatCast (A R : Type) [RatCast R] [RatCast A] [Approx A R] :

                              A has conservative conversion

                              Instances
                                class ApproxAddGroup (A R : Type) [AddGroup R] extends Zero A, Neg A, Add A, Sub A, Approx A R, ApproxZero A R, ApproxNeg A R, ApproxAdd A R, ApproxSub A R :

                                A approximates the additive group R

                                Instances
                                  class ApproxRing (A R : Type) [Ring R] extends ApproxAddGroup A R, One A, Mul A, ApproxOne A R, ApproxMul A R :

                                  A approximates the ring R

                                  Instances
                                    class ApproxField (A R : Type) [Field R] extends ApproxRing A R, Div A, ApproxDiv A R :

                                    A approximates the field R

                                    Instances
                                      theorem approx_zero_iff {R A : Type} [Approx A R] [Zero A] [Zero R] [ApproxZero A R] [ApproxZeroIff A R] (x : R) :
                                      approx 0 x x = 0

                                      Everything approximates itself #

                                      instance instApprox {R : Type} :
                                      Approx R R
                                      Equations
                                      instance instApproxZero {R : Type} [Zero R] :
                                      instance instApproxOne {R : Type} [One R] :
                                      instance instApproxNeg {R : Type} [Neg R] :
                                      instance instApproxAdd {R : Type} [Add R] :
                                      instance instApproxSub {R : Type} [Sub R] :
                                      instance instApproxMul {R : Type} [Mul R] :
                                      instance instApproxInv {R : Type} [Inv R] :
                                      instance instApproxDiv {R : Type} [Div R] :
                                      instance instApproxSMul {A B : Type} [SMul A B] :
                                      ApproxSMul A B A B

                                      Typeclass for nan #

                                      def approxSet {R A : Type} [Approx A R] (x : A) :
                                      Set R

                                      The set of approximated elements. Default to using approx as a membership function.

                                      Equations
                                      Instances For

                                        Typeclass for nan #

                                        class Nan (A : Type) :
                                        • nan : A
                                        Instances
                                          class ApproxNan (A R : Type) [Approx A R] [Nan A] :
                                          Instances

                                            Rounding utilities #

                                            For when we approximately round up or down.

                                            def Rounds {R A : Type} [Approx A R] [LE R] (x : A) (y : R) (up : Bool) :
                                            Equations
                                            Instances For
                                              @[simp]
                                              theorem rounds_same {I : Type} [LinearOrder I] {up : Bool} {x y : I} :
                                              Rounds x y up if up = true then y x else x y
                                              @[simp]
                                              theorem rounds_nan {A I : Type} [LinearOrder I] {up : Bool} [Approx A I] [Nan A] [ApproxNan A I] {y : I} :
                                              Rounds nan y up
                                              theorem rounds_neg {A I : Type} [LinearOrder I] {up : Bool} [Approx A I] [Neg A] [AddGroup I] [ApproxNeg A I] [AddLeftMono I] [AddRightMono I] {x : A} {y : I} (a : Rounds x (-y) !up) :
                                              Rounds (-x) y up
                                              theorem Rounds.neg {A I : Type} [LinearOrder I] {up : Bool} [Approx A I] [Neg A] [AddGroup I] [ApproxNeg A I] [AddLeftMono I] [AddRightMono I] {x : A} {y : I} (a : Rounds x y !up) :
                                              Rounds (-x) (-y) up

                                              approx machinery #

                                              Convexity of approx #

                                              class ApproxConnected (A R : Type) [Approx A R] [Preorder R] :

                                              A has a convex approx

                                              Instances
                                                theorem approx_of_mem_Icc {R A : Type} [Approx A R] [Preorder R] [ApproxConnected A R] {a b c : R} {x : A} (xa : approx x a) (xc : approx x c) (abc : b Set.Icc a c) :
                                                approx x b

                                                Icc ⊆ approx if the endpoints are included