Documentation

LeanCert.Core.DyadicCell

Finite dyadic addresses #

Finite Boolean paths are convenient for adaptive provenance. Indexed cells are convenient for fixed-depth arithmetic, serialization, and integration. This module provides both views and exact decoding into closed dyadic intervals.

Semantic equality of dyadic intervals, independent of endpoint representation.

Equations
Instances For
    @[reducible, inline]

    A finite sequence of left (false) and right (true) decisions.

    Equations
    Instances For

      The ordinary binary integer encoded by a path, most-significant bit first.

      Equations
      Instances For

        A finite binary path always denotes an index at its depth.

        Decode a path operationally by following exact interval bisections.

        Equations
        Instances For

          A fixed-depth dyadic cell, with its index bounded by the number of cells.

          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem LeanCert.Core.DyadicCell.ext' {a b : DyadicCell} (hdepth : a.depth = b.depth) (hindex : ↑a.index = ↑b.index) :
                a = b

                Cells are equal when their depths and numeric indices agree.

                The root cell at depth zero.

                Equations
                Instances For

                  The left child has index 2k.

                  Equations
                  Instances For

                    The right child has index 2k + 1.

                    Equations
                    Instances For

                      Convert a path into the corresponding bounded fixed-depth cell.

                      Equations
                      Instances For

                        Exact width of one cell at this depth.

                        Equations
                        Instances For

                          Decode an indexed cell directly from its affine endpoint formula.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            @[simp]
                            theorem LeanCert.Core.DyadicCell.step_toRat (root : IntervalDyadic) (cell : DyadicCell) :
                            (step root cell).toRat = root.width.toRat * 2 ^ (-↑cell.depth)
                            theorem LeanCert.Core.DyadicCell.step_toRat_nonneg (root : IntervalDyadic) (depth : ℕ) :
                            0 ≤ (root.width.scale2 (-↑depth)).toRat

                            The exact step at any depth is nonnegative.

                            Fixed-depth decoding context with the common cell width prepared once.

                            Instances For

                              Prepare the shared arithmetic for every cell at one subdivision depth.

                              Equations
                              Instances For

                                Number of cells at the prepared level.

                                Equations
                                Instances For

                                  Random-access decoding using the shared precomputed cell width.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    @[simp]
                                    @[simp]
                                    theorem LeanCert.Core.DyadicCell.PreparedDyadicLevel.intervalAt_hi_toRat (level : PreparedDyadicLevel) (index : Fin level.cellCount) :
                                    (level.intervalAt index).hi.toRat = level.root.lo.toRat + level.step.toRat * (↑↑index + 1)
                                    theorem LeanCert.Core.DyadicCell.PreparedDyadicLevel.intervalAt_valueEq_decodeDirect (level : PreparedDyadicLevel) (index : Fin level.cellCount) :
                                    (level.intervalAt index).ValueEq (decodeDirect level.root { depth := level.depth, index := index })

                                    Prepared random access agrees with the original direct decoder.

                                    Materialize a complete fixed-depth level by advancing adjacent endpoints.

                                    Equations
                                    Instances For
                                      @[simp]
                                      theorem LeanCert.Core.DyadicCell.decodeDirect_lo_toRat (root : IntervalDyadic) (cell : DyadicCell) :
                                      (decodeDirect root cell).lo.toRat = root.lo.toRat + (step root cell).toRat * ↑↑cell.index
                                      @[simp]
                                      theorem LeanCert.Core.DyadicCell.decodeDirect_hi_toRat (root : IntervalDyadic) (cell : DyadicCell) :
                                      (decodeDirect root cell).hi.toRat = root.lo.toRat + (step root cell).toRat * (↑↑cell.index + 1)

                                      Direct decoding gives every depth-n cell the root width divided by 2^n.

                                      Directly decoding the left child agrees semantically with bisecting the parent.

                                      Directly decoding the right child agrees semantically with bisecting the parent.

                                      Recursive bisection and direct affine decoding agree at every finite address.

                                      Closed proof semantics and canonical ownership #

                                      The closed proof cell at a fixed level. This is the interval supplied to certified numerical evaluation.

                                      Equations
                                      Instances For
                                        def LeanCert.Core.DyadicCell.Ownership.Owns (root : IntervalDyadic) (depth : ℕ) (index : Fin (2 ^ depth)) (x : ℝ) :

                                        Canonical ownership assigns a point to the greatest-index closed cell that contains it. Thus an interior seam belongs to the cell on its right, matching the half-open convention [lo, hi), while the final cell retains the root's right endpoint.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          def LeanCert.Core.DyadicCell.Ownership.ownerSet (root : IntervalDyadic) (depth : ℕ) (index : Fin (2 ^ depth)) :

                                          The set canonically owned by one fixed-depth cell.

                                          Equations
                                          Instances For

                                            The final index of a nonempty dyadic level.

                                            Equations
                                            Instances For
                                              theorem LeanCert.Core.DyadicCell.Ownership.ownerSet_subset_closedCell (root : IntervalDyadic) (depth : ℕ) (index : Fin (2 ^ depth)) :
                                              ownerSet root depth index ⊆ (closedCell root depth index).toSet

                                              Canonical ownership never enlarges the closed proof cell.

                                              theorem LeanCert.Core.DyadicCell.Ownership.ownerSet_disjoint {root : IntervalDyadic} {depth : ℕ} {i j : Fin (2 ^ depth)} (hne : i ≠ j) :
                                              Disjoint (ownerSet root depth i) (ownerSet root depth j)

                                              Distinct cells cannot canonically own the same point.

                                              theorem LeanCert.Core.DyadicCell.Ownership.not_owns_of_mem_higher {root : IntervalDyadic} {depth : ℕ} {i j : Fin (2 ^ depth)} {x : ℝ} (hij : i < j) (hj : x ∈ closedCell root depth j) :
                                              ¬Owns root depth i x

                                              A point contained in a higher-index cell cannot be owned by a lower cell. This is the abstract seam-welding rule.

                                              theorem LeanCert.Core.DyadicCell.Ownership.last_owns_of_mem {root : IntervalDyadic} {depth : ℕ} {x : ℝ} (hx : x ∈ closedCell root depth (lastIndex depth)) :
                                              Owns root depth (lastIndex depth) x

                                              Any point in the final closed cell is owned by that cell. In particular, the root's right endpoint remains owned rather than being discarded.

                                              theorem LeanCert.Core.DyadicCell.Ownership.exists_mem_closedCell (root : IntervalDyadic) (depth : ℕ) {x : ℝ} (hx : x ∈ root) :
                                              ∃ (index : Fin (2 ^ depth)), x ∈ closedCell root depth index

                                              Every point of the root lies in at least one fixed-depth closed proof cell.

                                              theorem LeanCert.Core.DyadicCell.Ownership.exists_unique_owner (root : IntervalDyadic) (depth : ℕ) {x : ℝ} (hx : x ∈ root) :
                                              ∃! index : Fin (2 ^ depth), Owns root depth index x

                                              Every root point has a unique canonical owner at each fixed depth.

                                              theorem LeanCert.Core.DyadicCell.Ownership.mem_ownerSet_of_mem_root (root : IntervalDyadic) (depth : ℕ) {x : ℝ} (hx : x ∈ root) :
                                              ∃ (index : Fin (2 ^ depth)), x ∈ ownerSet root depth index

                                              Canonical ownership covers the entire root interval.