MindFormal v1.0.0One Mind

MindFormal.Tools.ContractionCertificate

02.20: the checkable form of a one-sided Lipschitz constant. A slope enclosure for the expression language: over a box, an expression's change between two points of the box is a sum over its variables of a coefficient times that variable's change, each coefficient in an interval computed by rational arithmetic (a sum adds them; a product A·B weighs B's by A's range and A's by B's; the positive part and the absolute value scale by a factor in [0,1] or [−1,1], the reciprocal by −1/(AA′)). For a field of expressions and positive weights w, the quantity the checker certifies for μ is, for each coordinate i, the upper end of its own coefficient plus Σ_{j≠i} (w_i/w_j) times the largest magnitude of its coefficient on j. Its soundness theorem gives the contraction enclosure's hypothesis on the tube of the weighted sup norm max_i w_i|z_i|. No mind.

theorem MindFormal.exp_le_expUpper_of_abs_le {y : ℚ} (h : |y| ≤ 1) :
Real.exp ↑y ≤ ↑(expUpper y)

02.20: exp y ≤ expUpper y for |y| ≤ 1, of either sign (the remainder's eighth power is even).

02.20: the product of two rational intervals, from its four corners.

Equations
Instances For

    02.20: the sum of two rational intervals.

    Equations
    Instances For

      02.20: the largest magnitude in a rational interval.

      Equations
      Instances For
        theorem MindFormal.imul_mem {a b : ℚ × ℚ} {x y : ℝ} (hx : ↑a.1 ≤ x ∧ x ≤ ↑a.2) (hy : ↑b.1 ≤ y ∧ y ≤ ↑b.2) :
        ↑(imul a b).1 ≤ x * y ∧ x * y ≤ ↑(imul a b).2
        theorem MindFormal.abs_le_imag {a : ℚ × ℚ} {x : ℝ} (hx : ↑a.1 ≤ x ∧ x ≤ ↑a.2) :
        |x| ≤ ↑(imag a)
        theorem MindFormal.exists_pos_factor (A A' : ℝ) :
        ∃ (θ : ℝ), 0 ≤ θ ∧ θ ≤ 1 ∧ max A 0 - max A' 0 = θ * (A - A')

        02.20: the positive part's change is a factor in [0,1] times its argument's.

        theorem MindFormal.exists_abs_factor (A A' : ℝ) :
        ∃ (θ : ℝ), |θ| ≤ 1 ∧ |A| - |A'| = θ * (A - A')

        02.20: the absolute value's change is a factor in [−1,1] times its argument's.

        02.20: the positive part's slope interval: its argument's where the argument stays nonnegative, zero where it stays nonpositive, else the argument's scaled by [0,1].

        Equations
        Instances For

          02.20: the absolute value's slope interval: its argument's, or its negative, where the argument keeps its sign, else the argument's scaled by [−1,1].

          Equations
          Instances For

            02.20: the reciprocal's slope interval: its argument's scaled by −1/(AA′) ∈ [−1/lo², −1/hi²].

            Equations
            Instances For
              def MindFormal.RExpr.slope {V : Type u} [DecidableEq V] (B : V → ℚ × ℚ) (u : V) :
              RExpr V → ℚ × ℚ

              02.20: THE SLOPE ENCLOSURE of an expression in the variable u over a box B: an interval holding the coefficient of u's change in the expression's change between any two points of the box.

              Equations
              Instances For
                theorem MindFormal.RExpr.slope_sound {V : Type u} [DecidableEq V] [Fintype V] (B : V → ℚ × ℚ) (e : RExpr V) (h : (bound B e).ok = true) {ρ ρ' : V → ℝ} (hρ : InBox B ρ) (hρ' : InBox B ρ') :
                ∃ (c : V → ℝ), (∀ (u : V), ↑(slope B u e).1 ≤ c u ∧ c u ≤ ↑(slope B u e).2) ∧ eval ρ e - eval ρ' e = ∑ u : V, c u * (ρ u - ρ' u)

                02.20: soundness of the slope enclosure. If the expression's enclosure over the box is defined, then between any two points of the box its change is Σ_u c_u·(ρ_u − ρ′_u) for coefficients c_u each in its slope interval.

                noncomputable def MindFormal.weightMap {S : Type u} (w : S → ℚ) :
                (S → ℝ) →L[ℝ] S → ℝ

                02.20: the weighted sup norm's map, each coordinate scaled by its weight: ‖weightMap w z‖ is max_i |w_i z_i|.

                Equations
                Instances For
                  @[simp]
                  theorem MindFormal.weightMap_apply {S : Type u} (w : S → ℚ) (z : S → ℝ) (i : S) :
                  (weightMap w) z i = ↑(w i) * z i
                  theorem MindFormal.abs_sub_le_of_weightMap {S : Type u} [Fintype S] {w : S → ℚ} {z c : S → ℝ} {r : ℝ} (hz : ‖(weightMap w) (z - c)‖ ≤ r) {i : S} (hw : 0 < ↑(w i)) :
                  |z i - c i| ≤ r / ↑(w i)

                  02.20: a coordinate of a point in the weighted tube is within r/w of the center's.

                  theorem MindFormal.sum_le_list_sum {α : Type u_1} [Fintype α] {L : List α} (hL : ∀ (a : α), a ∈ L) {f : α → ℝ} (hf : ∀ (a : α), 0 ≤ f a) :
                  ∑ a : α, f a ≤ (List.map f L).sum

                  02.20: a sum over a finite type is at most the sum over a list that names every element, when the terms are nonnegative.

                  def MindFormal.PieceData.wbox {S P : Type u} (d : PieceData S P) (w : S → ℚ) (r : ℚ) :
                  S ⊕ P → ℚ × ℚ

                  02.20: the box holding the weighted tube of width r: each state variable within its path's travel plus r/w of the path's start, each parameter within its travel plus η of its start.

                  Equations
                  Instances For
                    theorem MindFormal.PieceData.inWBox {S P : Type u} (d : PieceData S P) {w : S → ℚ} {r : ℚ} {x : ℝ} (hx : x ∈ Set.Icc 0 ↑d.h) (z : S → ℝ) (π : P → ℝ) (hz : ∀ (v : S), |z v - d.pathR x v| ≤ ↑(r / w v)) (hπ : ∀ (v : P), |π v - d.paramR x v| ≤ ↑d.η) :
                    RExpr.InBox (d.wbox w r) (Sum.elim z π)

                    02.20: at every time of the piece, a state whose coordinates are within r/w of the path's and parameters within η of theirs lie in the weighted box.

                    def MindFormal.PieceData.oslRate {S P : Type u} (d : PieceData S P) [DecidableEq S] [DecidableEq P] (Svars : List S) (F : S → RExpr (S ⊕ P)) (w : S → ℚ) (r : ℚ) (i : S) :

                    02.20: THE QUANTITY CERTIFIED FOR μ, coordinate i's one-sided rate on the weighted box: the upper end of i's coefficient on itself plus Σ_{j≠i} (w_i/w_j) times the largest magnitude of its coefficient on j.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def MindFormal.PieceData.oslCheck {S P : Type u} (d : PieceData S P) [DecidableEq S] [DecidableEq P] (Svars : List S) (F : S → RExpr (S ⊕ P)) (w : S → ℚ) (r μ : ℚ) :

                      02.20: THE ONE-SIDED CHECKER, by rational arithmetic only: every weight positive, every field coordinate defined on the weighted box, and every coordinate's rate at most μ.

                      Equations
                      Instances For
                        theorem MindFormal.PieceData.oslCheck_sound {S P : Type u} (d : PieceData S P) [DecidableEq S] [DecidableEq P] [Fintype S] [Finite P] {Svars : List S} {F : S → RExpr (S ⊕ P)} {w : S → ℚ} {r μ : ℚ} (hS : ∀ (v : S), v ∈ Svars) (hc : d.oslCheck Svars F w r μ = true) {x : ℝ} (hx : x ∈ Set.Icc 0 ↑d.h) {π : P → ℝ} (hπ : ∀ (v : P), |π v - d.paramR x v| ≤ ↑d.η) {z z' : S → ℝ} (hz : ‖(weightMap w) (z - d.pathR x)‖ ≤ ↑r) (hz' : ‖(weightMap w) (z' - d.pathR x)‖ ≤ ↑r) :
                        ∃ h₀ > 0, ∀ h ∈ Set.Ioo 0 h₀, ‖(weightMap w) (z - z' + h • (fieldR F π z - fieldR F π z'))‖ ≤ (1 + h * ↑μ) * ‖(weightMap w) (z - z')‖

                        02.20: soundness of the one-sided checker. If it passes (with a list naming every state variable), then at every time x of the piece, for parameters π within η of their polynomials and any two states z, z′ within r of the path in the weighted norm, a short Euler step of the field moves them apart by at most the factor 1 + hμ: for all small h > 0, ‖W(z − z′ + h(F(z) − F(z′)))‖ ≤ (1 + hμ)‖W(z − z′)‖, W the weights' map.