Documentation

LeanCert.Core.IntervalRat.Basic

Rational Endpoint Intervals - Core Definitions #

This file defines IntervalRat, a concrete interval type with rational endpoints suitable for computation. We prove the Fundamental Theorem of Interval Arithmetic (FTIA) for each operation.

Main definitions #

Main theorems #

Design notes #

All operations maintain the invariant lohi. Domain restrictions for partial operations (like inv) are encoded via separate types or explicit hypotheses.

An interval with rational endpoints

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

      Default interval [0, 0] for unsupported expression branches

      Equations

      The set of reals contained in this interval

      Equations
      Instances For
        @[simp]
        theorem LeanCert.Core.IntervalRat.mem_def (x : ) (I : IntervalRat) :
        x I I.lo x x I.hi

        Membership in IntervalRat is the same as membership in Set.Icc

        theorem LeanCert.Core.IntervalRat.forall_mem_iff_forall_Icc {P : Prop} (I : IntervalRat) :
        (∀ xI, P x) xSet.Icc I.lo I.hi, P x

        Universal quantifier over IntervalRat equals universal over Set.Icc

        theorem LeanCert.Core.IntervalRat.exists_mem_iff_exists_Icc {P : Prop} (I : IntervalRat) :
        (∃ xI, P x) xSet.Icc I.lo I.hi, P x

        Existence in IntervalRat equals existence in Set.Icc

        Create an interval from a single rational

        Equations
        Instances For

          The width of an interval

          Equations
          Instances For

            Midpoint of an interval

            Equations
            Instances For

              The midpoint of an interval is contained in the interval

              Interval addition #

              Add two intervals

              Equations
              Instances For
                theorem LeanCert.Core.IntervalRat.mem_add {x y : } {I J : IntervalRat} (hx : x I) (hy : y J) :
                x + y I.add J

                FTIA for addition

                Interval negation #

                Negate an interval

                Equations
                Instances For
                  theorem LeanCert.Core.IntervalRat.mem_neg {x : } {I : IntervalRat} (hx : x I) :
                  -x I.neg

                  FTIA for negation

                  Interval subtraction #

                  Subtract two intervals

                  Equations
                  Instances For
                    theorem LeanCert.Core.IntervalRat.mem_sub {x y : } {I J : IntervalRat} (hx : x I) (hy : y J) :
                    x - y I.sub J

                    FTIA for subtraction

                    Interval multiplication #

                    Multiply two intervals

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      theorem LeanCert.Core.IntervalRat.mem_mul {x y : } {I J : IntervalRat} (hx : x I) (hy : y J) :
                      x * y I.mul J

                      FTIA for multiplication

                      Interval containing zero check #

                      Check if an interval contains zero

                      Equations
                      Instances For

                        An interval that is guaranteed not to contain zero

                        Instances For

                          Interval inversion (for nonzero intervals) #

                          Invert an interval that doesn't contain zero

                          Equations
                          Instances For

                            FTIA for inversion #

                            Scalar operations #

                            Scale an interval by a rational

                            Equations
                            Instances For
                              theorem LeanCert.Core.IntervalRat.mem_scale {x : } {I : IntervalRat} (q : ) (hx : x I) :
                              q * x scale q I

                              FTIA for scaling

                              Interval splitting #

                              Split an interval at its midpoint

                              Equations
                              Instances For
                                theorem LeanCert.Core.IntervalRat.mem_bisect_left {x : } {I : IntervalRat} (hx : x I) (hm : x I.midpoint) :
                                x I.bisect.1
                                theorem LeanCert.Core.IntervalRat.mem_bisect_right {x : } {I : IntervalRat} (hx : x I) (hm : I.midpoint x) :
                                x I.bisect.2
                                theorem LeanCert.Core.IntervalRat.midpoint_sub_lo (I : IntervalRat) :
                                I.midpoint - I.lo = (I.hi - I.lo) / 2

                                Distance from midpoint to lo is half the width

                                theorem LeanCert.Core.IntervalRat.hi_sub_midpoint (I : IntervalRat) :
                                I.hi - I.midpoint = (I.hi - I.lo) / 2

                                Distance from hi to midpoint is half the width

                                Midpoint is at least lo (real version)

                                Midpoint is at most hi (real version)

                                Left bisection is a subset of the original interval

                                Right bisection is a subset of the original interval

                                theorem LeanCert.Core.IntervalRat.mem_bisect_or {x : } {I : IntervalRat} (hx : x I) :
                                x I.bisect.1 x I.bisect.2

                                Any point in an interval is in one of its bisected halves

                                The default interval [0,0] contains only 0

                                Interval intersection #

                                Intersect two intervals. Returns none if they don't intersect.

                                Equations
                                Instances For
                                  theorem LeanCert.Core.IntervalRat.mem_intersect {x : } {I J : IntervalRat} (hI : x I) (hJ : x J) :
                                  ∃ (K : IntervalRat), I.intersect J = some K x K

                                  If intersection succeeds, the result contains any point in both intervals

                                  If intersection returns some K, then K ⊆ I

                                  If intersection returns some K, then K ⊆ J