Documentation

Miri.TreeBorrows.TreeState

The allocation-local state layout from Miri's tree_borrows/tree.rs: tag-to-index map, indexed nodes, per-range location data, and ordered roots. The first constructor is the exact Tree::new root state. Diagnostic-only node history is intentionally omitted. Child insertion and access traversal are separate operations.

Per-node information consumed by tree traversal and permission defaults. The source's NodeDebugInfo name is retained because miri_pointer_name and miri_print_borrow_state expose it. Access history is diagnostic-only and is not needed to print the current tree.

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
        Equations
        Instances For

          Willard-cache counters for one node at one homogeneous byte range. Counters keep the source's u16 width.

          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
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Wildcard-relatedness cache for one location range.

                  Instances For
                    Equations
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        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
                              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

                                  Source ExposedCache::update_exposure: update the node's counters and propagate the same exposure delta through each ancestor. On malformed node indices/cycles, preserve all earlier counter mutations in the returned cache.

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

                                      The source's LocationTree: lazily stored permission state and one exposed-node cache per homogeneous range.

                                      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

                                            Allocation-local tree state. roots begins with the allocation's unique root and may later contain ordered wildcard roots.

                                            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
                                                  Instances For
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For

                                                      Source Tree::nth_parent, with malformed/exhausted ancestry retained as a checked machine error by diagnostic callers instead of an unchecked unwrap.

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

                                                        Source NodeDebugInfo::add_name: several names for one tag are joined with ", " in their insertion order.

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

                                                          Source Tree::give_pointer_debug_name, including ancestor selection.

                                                          Equations
                                                          Instances For

                                                            Source Tree::new: disabled default at out-of-bounds/uninitialized locations, one non-exposed root, and an accessed Unique permission throughout the allocation's in-bounds bytes.

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

                                                                Current or lazily initialized per-location state for a node.

                                                                Equations
                                                                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
                                                                      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
                                                                          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
                                                                              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
                                                                                    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
                                                                                        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
                                                                                              Equations
                                                                                              • One or more equations did not get rendered due to their size.
                                                                                              Instances For
                                                                                                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
                                                                                                      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
                                                                                                          def Miri.TreeBorrows.BorrowTree.performWildcardAccessAt (tree : BorrowTree) (initialLocation : LocationTree) (root : UniIndex) (maxLocalTag : Option Memory.BorTag) (kind : AccessKind) (protectedTags : ProtectedTags) (isWildcardTree : Bool) :

                                                                                                          Source LocationTree::perform_wildcard_access. The stack implements the source visitor's child-first, postorder traversal. Relatedness and SIFA skip decisions are recomputed against the cache as child transitions change it.

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

                                                                                                            Perform the source normal-tree component at one actual tree location. Permission transitions are delegated to NormalTreeState; this operation projects the source UniValMap topology and lazy defaults, writes state back to the real maps, and applies exposed-cache deltas in visit order. Additional wildcard roots are handled by the separate wildcard-access component.

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

                                                                                                              Source Tree::expose_tag, including the per-range Willard-cache update. The global protected-tag table determines which local accesses remain valid through this exposed tag.

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

                                                                                                                Source update_exposure_for_protector_release: exposed nodes retain their exposure, while the cache counters change from protected to unprotected local permission strength.

                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                Instances For
                                                                                                                  def Miri.TreeBorrows.BorrowTree.newChild (tree : BorrowTree) (baseOffset : ABI.Size) (parentProvenance : Memory.ProvenanceExtra) (newTag : Memory.BorTag) (insidePermissions : DataStructures.DedupRangeMap Tree.LocationState) (outsidePermission : Permission) (isProtected : Bool) :

                                                                                                                  Source Tree::new_child: allocate the tag index, attach a concrete child or ordered wildcard root, store lazy defaults, materialize inside-range permissions, and weaken ancestor SIFAs until the retag invariant is restored. Mutation and invariant failures retain earlier source-ordered state changes.

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

                                                                                                                    Tags reported by source VisitProvenance for Tree: all roots and every exposed node whose provenance may still permit an access.

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

                                                                                                                      Source Tree::remove_unreachable_tags: process each ordered root with postorder leaf removal and safe single-child collapse, then thoroughly merge adjacent equal location ranges.

                                                                                                                      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
                                                                                                                          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
                                                                                                                              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
                                                                                                                                  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
                                                                                                                                      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
                                                                                                                                          Equations
                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                          Instances For

                                                                                                                                            Ranged access for concrete or wildcard provenance. Tree state and Willard-cache updates are threaded across homogeneous range segments and all ordered roots.

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

                                                                                                                                              Concrete-tag convenience wrapper over the full source-root access path.

                                                                                                                                              Equations
                                                                                                                                              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
                                                                                                                                                    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

                                                                                                                                                        Source Tree::perform_protector_end_access followed by update_exposure_for_protector_release. The tag remains protected during its implicit accessed-location read/write, and the caller removes the global protector only after this operation succeeds.

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

                                                                                                                                                          Source Tree::dealloc for a single concrete root: first perform the write through the supplied tag, then inspect visited nodes in source tree-visitor order for accessed strong protectors. Cell permissions are exempt. Weak protectors are handled by the initial write transition itself.

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

                                                                                                                                                            Concrete-tag convenience wrapper for source Tree::dealloc.

                                                                                                                                                            Equations
                                                                                                                                                            Instances For
                                                                                                                                                              @[simp]
                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.new_root_node (rootTag : Memory.BorTag) (size : ABI.Size) :
                                                                                                                                                              (new rootTag size).nodes.get { idx := 0 } = some { tag := rootTag, parent := none, defaultInitialPermission := Permission.newDisabled, defaultInitialSifa := IdempotentForeignAccess.None }
                                                                                                                                                              @[simp]
                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.new_root_is_only_tree_root (rootTag : Memory.BorTag) (size : ABI.Size) :
                                                                                                                                                              (new rootTag size).roots = #[{ idx := 0 }]

                                                                                                                                                              Zero-byte protected child construction from finite graph and allocator invariants. These proof-only declarations do not change the interpreter. The rank and loop lemmas are adapted from PR35/38 generic Tree Borrows proofs.

                                                                                                                                                              Equations
                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                              Instances For
                                                                                                                                                                theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.loop_invariant {β : Type} (scan : Unit → β → Id (ForInStep β)) (measure : β → Nat) (property : β → Prop) (step : ∀ (state : β), property state → (∃ (final : β), scan () state = ForInStep.done final ∧ property final) ∨ ∃ (next : β), scan () state = ForInStep.yield next ∧ property next ∧ measure next < measure state) (initial : β) (valid : property initial) :
                                                                                                                                                                property ({ }.forIn initial scan)

                                                                                                                                                                A source while-loop invariant with a well-founded data measure.

                                                                                                                                                                Instances For
                                                                                                                                                                  theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.index_injective (left right : UniIndex) (same : left.toNat = right.toNat) :
                                                                                                                                                                  left = right
                                                                                                                                                                  theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.lookup_valid {α : Type} (nodes : UniValMap α) (index : UniIndex) (value : α) (present : nodes.get index = some value) :
                                                                                                                                                                  index.toNat < nodes.data.size
                                                                                                                                                                  theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.insert_existing {α : Type} (nodes : UniValMap α) (index : UniIndex) (old next : α) (present : nodes.get index = some old) :
                                                                                                                                                                  (nodes.insert index next).data = nodes.data.set index.toNat (some next) ⋯
                                                                                                                                                                  theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.insert_existing_get_same {α : Type} (nodes : UniValMap α) (index : UniIndex) (old next : α) (present : nodes.get index = some old) :
                                                                                                                                                                  (nodes.insert index next).get index = some next
                                                                                                                                                                  theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.insert_existing_get_other {α : Type} (nodes : UniValMap α) (index query : UniIndex) (old next : α) (present : nodes.get index = some old) (different : query ≠ index) :
                                                                                                                                                                  (nodes.insert index next).get query = nodes.get query
                                                                                                                                                                  theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.insert_existing_size {α : Type} (nodes : UniValMap α) (index : UniIndex) (old next : α) (present : nodes.get index = some old) :
                                                                                                                                                                  (nodes.insert index next).size = nodes.size
                                                                                                                                                                  def Miri.TreeBorrows.BorrowTree.ZeroProtection.update_depth (nodes : UniValMap TreeNode) (depth : ParentDepth nodes) (index : UniIndex) (old next : TreeNode) (present : nodes.get index = some old) (sameParent : next.parent = old.parent) :
                                                                                                                                                                  ParentDepth (nodes.insert index next)

                                                                                                                                                                  Changing non-parent node metadata preserves the real exposed-cache ancestor certificate and its depth function.

                                                                                                                                                                  Equations
                                                                                                                                                                  Instances For
                                                                                                                                                                    @[reducible, inline]
                                                                                                                                                                    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
                                                                                                                                                                        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
                                                                                                                                                                            Equations
                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                            Instances For
                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.succeeds (tree : BorrowTree) (depth : ParentDepth tree.nodes) (start : UniIndex) (node : TreeNode) (present : tree.nodes.get start = some node) (strict : depth.depth start < tree.nodes.size) (strongest : IdempotentForeignAccess) :
                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Append.insert_append {α : Type} (nodes : UniValMap α) (index : UniIndex) (value : α) (atEnd : index.toNat = nodes.data.size) :
                                                                                                                                                                              (nodes.insert index value).data = nodes.data.push (some value)

                                                                                                                                                                              The append-index branch of the actual newChild node insertion. Existing node data and parent depth are arbitrary; free-index reuse is a separate case.

                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Append.append_size {α : Type} (nodes : UniValMap α) (index : UniIndex) (value : α) (atEnd : index.toNat = nodes.data.size) :
                                                                                                                                                                              (nodes.insert index value).size = nodes.size + 1
                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Append.append_get_same {α : Type} (nodes : UniValMap α) (index : UniIndex) (value : α) (atEnd : index.toNat = nodes.data.size) :
                                                                                                                                                                              (nodes.insert index value).get index = some value
                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Append.append_get_other {α : Type} (nodes : UniValMap α) (index query : UniIndex) (value : α) (atEnd : index.toNat = nodes.data.size) (different : query ≠ index) :
                                                                                                                                                                              (nodes.insert index value).get query = nodes.get query
                                                                                                                                                                              def Miri.TreeBorrows.BorrowTree.ZeroProtection.Append.append_depth (nodes : UniValMap TreeNode) (before : ParentDepth nodes) (index parent : UniIndex) (parentNode newNode : TreeNode) (atEnd : index.toNat = nodes.data.size) (parentPresent : nodes.get parent = some parentNode) (childParent : newNode.parent = some parent) :
                                                                                                                                                                              ParentDepth (nodes.insert index newNode)
                                                                                                                                                                              Equations
                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                              Instances For

                                                                                                                                                                                The second source-ordered node insertion in newChild attaches the new index to its parent's children, without changing either node's parent link.

                                                                                                                                                                                Equations
                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                Instances For
                                                                                                                                                                                  theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Append.parent_not_fresh (nodes : UniValMap TreeNode) (index parent : UniIndex) (parentNode : TreeNode) (atEnd : index.toNat = nodes.data.size) (parentPresent : nodes.get parent = some parentNode) :
                                                                                                                                                                                  parent ≠ index
                                                                                                                                                                                  def Miri.TreeBorrows.BorrowTree.ZeroProtection.Append.attached_depth (nodes : UniValMap TreeNode) (before : ParentDepth nodes) (index parent : UniIndex) (parentNode newNode : TreeNode) (atEnd : index.toNat = nodes.data.size) (parentPresent : nodes.get parent = some parentNode) (childParent : newNode.parent = some parent) :
                                                                                                                                                                                  ParentDepth (attachedNodes nodes index parent parentNode newNode)
                                                                                                                                                                                  Equations
                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                  Instances For
                                                                                                                                                                                    theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Append.attached_parent_strict (nodes : UniValMap TreeNode) (before : ParentDepth nodes) (index parent : UniIndex) (parentNode newNode : TreeNode) (atEnd : index.toNat = nodes.data.size) (parentPresent : nodes.get parent = some parentNode) (childParent : newNode.parent = some parent) :
                                                                                                                                                                                    (attached_depth nodes before index parent parentNode newNode atEnd parentPresent childParent).depth parent < (attachedNodes nodes index parent parentNode newNode).size
                                                                                                                                                                                    theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Append.sifa_after_attach (tree : BorrowTree) (before : ParentDepth tree.nodes) (index parent : UniIndex) (parentNode newNode : TreeNode) (atEnd : index.toNat = tree.nodes.data.size) (parentPresent : tree.nodes.get parent = some parentNode) (childParent : newNode.parent = some parent) (strongest : IdempotentForeignAccess) :
                                                                                                                                                                                    (Miri.TreeBorrows.BorrowTree.updateSifaAfterRetag✝ { tagMapping := tree.tagMapping, nodes := attachedNodes tree.nodes index parent parentNode newNode, locations := tree.locations, roots := tree.roots } parent strongest).snd = Except.ok ()

                                                                                                                                                                                    The real ancestor-SIFA stage invoked by newChild succeeds after its two actual node insertions. The new index and original parent's presence are data conditions; no successful child insertion or SIFA update is a premise.

                                                                                                                                                                                    theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Sparse.extend_get {α : Type} (map : UniValMap α) (length : Nat) (index : UniIndex) :
                                                                                                                                                                                    { data := UniValMap.extendTo map.data length }.get index = map.get index

                                                                                                                                                                                    Extending a sparse location map with absent entries preserves every lookup, including queries beyond both its old and new extents.

                                                                                                                                                                                    theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Sparse.get_same {α : Type} (map : UniValMap α) (index : UniIndex) (value : α) :
                                                                                                                                                                                    (map.insert index value).get index = some value

                                                                                                                                                                                    The actual sparse-map insertion stores the new child's materialized state.

                                                                                                                                                                                    theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Sparse.get_other {α : Type} (map : UniValMap α) (index query : UniIndex) (value : α) (different : query ≠ index) :
                                                                                                                                                                                    (map.insert index value).get query = map.get query

                                                                                                                                                                                    Inserting the new child state preserves every other node's state even when the per-location sparse array has a different length from the node table.

                                                                                                                                                                                    theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Reuse.insert_bounded {α : Type} (nodes : UniValMap α) (index : UniIndex) (value : α) (valid : index.toNat < nodes.data.size) :
                                                                                                                                                                                    (nodes.insert index value).data = nodes.data.set index.toNat (some value) valid

                                                                                                                                                                                    Insertion at a bounded sparse slot retains the table length. Vacancy is a separate caller condition: this operation itself also permits overwriting.

                                                                                                                                                                                    theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Reuse.bounded_size {α : Type} (nodes : UniValMap α) (index : UniIndex) (value : α) (valid : index.toNat < nodes.data.size) :
                                                                                                                                                                                    (nodes.insert index value).size = nodes.size
                                                                                                                                                                                    theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Reuse.parent_not_vacant (nodes : UniValMap TreeNode) (index parent : UniIndex) (parentNode : TreeNode) (vacant : nodes.get index = none) (parentPresent : nodes.get parent = some parentNode) :
                                                                                                                                                                                    parent ≠ index
                                                                                                                                                                                    def Miri.TreeBorrows.BorrowTree.ZeroProtection.Reuse.vacant_depth (nodes : UniValMap TreeNode) (before : ParentDepth nodes) (index parent : UniIndex) (parentNode newNode : TreeNode) (valid : index.toNat < nodes.data.size) (vacant : nodes.get index = none) (parentPresent : nodes.get parent = some parentNode) (childParent : newNode.parent = some parent) (parentSlack : before.depth parent < nodes.size) :
                                                                                                                                                                                    ParentDepth (nodes.insert index newNode)

                                                                                                                                                                                    A bounded vacant slot can hold a fresh child. The explicit rank slack ensures the child's parent-rank-plus-one fits without enlarging the table. Every old parent edge remains valid; none can point to the vacant slot.

                                                                                                                                                                                    Equations
                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                    Instances For
                                                                                                                                                                                      def Miri.TreeBorrows.BorrowTree.ZeroProtection.Reuse.attached_depth (nodes : UniValMap TreeNode) (before : ParentDepth nodes) (index parent : UniIndex) (parentNode newNode : TreeNode) (valid : index.toNat < nodes.data.size) (vacant : nodes.get index = none) (parentPresent : nodes.get parent = some parentNode) (childParent : newNode.parent = some parent) (parentSlack : before.depth parent < nodes.size) :
                                                                                                                                                                                      ParentDepth (Append.attachedNodes nodes index parent parentNode newNode)

                                                                                                                                                                                      Both source node insertions preserve the depth certificate on a reusable slot. No absence of per-location permissions is inferred from node vacancy.

                                                                                                                                                                                      Equations
                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                      Instances For
                                                                                                                                                                                        theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Reuse.attached_parent_strict (nodes : UniValMap TreeNode) (before : ParentDepth nodes) (index parent : UniIndex) (parentNode newNode : TreeNode) (valid : index.toNat < nodes.data.size) (vacant : nodes.get index = none) (parentPresent : nodes.get parent = some parentNode) (childParent : newNode.parent = some parent) (parentSlack : before.depth parent < nodes.size) :
                                                                                                                                                                                        (attached_depth nodes before index parent parentNode newNode valid vacant parentPresent childParent parentSlack).depth parent < (Append.attachedNodes nodes index parent parentNode newNode).size
                                                                                                                                                                                        theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Reuse.sifa_after_attach (tree : BorrowTree) (before : ParentDepth tree.nodes) (index parent : UniIndex) (parentNode newNode : TreeNode) (valid : index.toNat < tree.nodes.data.size) (vacant : tree.nodes.get index = none) (parentPresent : tree.nodes.get parent = some parentNode) (childParent : newNode.parent = some parent) (parentSlack : before.depth parent < tree.nodes.size) (strongest : IdempotentForeignAccess) :
                                                                                                                                                                                        (Miri.TreeBorrows.BorrowTree.updateSifaAfterRetag✝ { tagMapping := tree.tagMapping, nodes := Append.attachedNodes tree.nodes index parent parentNode newNode, locations := tree.locations, roots := tree.roots } parent strongest).snd = Except.ok ()
                                                                                                                                                                                        theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.concrete_child (tree : BorrowTree) (depth : ParentDepth tree.nodes) (parentTag tag : Memory.BorTag) (parent : UniIndex) (parentNode : TreeNode) (tagged : tree.tagMapping.get parentTag = some parent) (present : tree.nodes.get parent = some parentNode) (fresh : tree.tagMapping.get tag = none) (room : tree.tagMapping.mapping.size ≤ 4294967295) (appendAligned : tree.tagMapping.deassigned.back? = none → tree.tagMapping.mapping.size = tree.nodes.size) (reuseValid : ∀ (index : UniIndex), tree.tagMapping.deassigned.back? = some index → index.toNat < tree.nodes.size ∧ tree.nodes.get index = none) (rank : depth.depth parent < tree.nodes.size) (offset : ABI.Size) (initial : Tree.LocationState) :

                                                                                                                                                                                        Both concrete allocation branches of a zero-byte protected child complete from raw parent, allocator and acyclic-graph facts.

                                                                                                                                                                                        theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.View.insert_existing_shape {α β : Type} (shape : α → β) (nodes : UniValMap α) (index : UniIndex) (old next : α) (present : nodes.get index = some old) (same : shape next = shape old) :
                                                                                                                                                                                        Array.map (Option.map shape) (nodes.insert index next).data = Array.map (Option.map shape) nodes.data
                                                                                                                                                                                        Equations
                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                        Instances For
                                                                                                                                                                                          theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.View.weakened_tree_shape (tree : BorrowTree) (index : UniIndex) (node : TreeNode) (present : tree.nodes.get index = some node) (strongest : IdempotentForeignAccess) :
                                                                                                                                                                                          treeShape (weakened tree index node strongest) = treeShape tree
                                                                                                                                                                                          Equations
                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                          Instances For

                                                                                                                                                                                            Even an error result changes no tag/topology/permission/accessed data in this SIFA-only stage. This metadata fact is not an assertion of safe execution.

                                                                                                                                                                                            theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.View.mapped_lookup {A B : Type} (shape : A → B) (nodes : UniValMap A) (index : UniIndex) :
                                                                                                                                                                                            (Array.map (Option.map shape) nodes.data)[index.toNat]?.getD none = Option.map shape (nodes.get index)

                                                                                                                                                                                            Sparse lookup commutes with the observable metadata projection.

                                                                                                                                                                                            theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.View.node_fields (before after : BorrowTree) (same : treeShape after = treeShape before) (index : UniIndex) (node : TreeNode) (present : before.nodes.get index = some node) :
                                                                                                                                                                                            ∃ (result : TreeNode), after.nodes.get index = some result ∧ result.tag = node.tag ∧ result.isExposed = node.isExposed

                                                                                                                                                                                            In particular, SIFA weakening preserves any fresh node's tag and exposure.

                                                                                                                                                                                            theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.View.absent_permissions (before after : BorrowTree) (same : treeShape after = treeShape before) (index : UniIndex) (absent : ∀ (position : Nat) (valid : position < before.locations.entries.size), before.locations.entries[position].data.perms.get index = none) (position : Nat) (valid : position < after.locations.entries.size) :
                                                                                                                                                                                            after.locations.entries[position].data.perms.get index = none

                                                                                                                                                                                            An index absent from every location remains absent after SIFA weakening; we do not assume that physical node vacancy alone implies permission vacancy.

                                                                                                                                                                                            theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Release.index_exact {A : Type} (map : DataStructures.DedupRangeMap A) (position : Nat) (valid : position < map.entries.size) :
                                                                                                                                                                                            map.index position = Except.ok map.entries[position]

                                                                                                                                                                                            An in-range raw range-map index always supplies its actual stored segment.

                                                                                                                                                                                            theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Release.list_tail {α β : Type} (items : List α) (scan : α → β → Id (ForInStep β)) (property : List α → β → Prop) (initial : β) (good : property items initial) (distinct : items.Nodup) (step : ∀ (item : α) (rest : List α), ¬item ∈ rest → ∀ (state : β), property (item :: rest) state → ∃ (next : β), scan item state = ForInStep.yield next ∧ property rest next) :
                                                                                                                                                                                            property [] (forIn items initial scan)
                                                                                                                                                                                            Equations
                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                            Instances For
                                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Release.release (tree : BorrowTree) (tag : Memory.BorTag) (index : UniIndex) (node : TreeNode) (tagged : tree.indexOfTag tag = some index) (present : tree.nodeAt index = some node) (unexposed : node.isExposed = false) (absent : ∀ (position : Nat) (valid : position < tree.locations.entries.size), tree.locations.entries[position].data.perms.get index = none) (protections : ProtectedTags) :
                                                                                                                                                                                              tree.releaseProtector tag protections = { tree := tree, status := ProtectorReleaseStatus.Released }

                                                                                                                                                                                              Releasing an unexposed zero-sized reservation with no materialized states really scans all allocation locations, skips each absent permission, and returns Released. Existing roots, ranges and exposure caches are preserved.

                                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Release.after_sifa (tree : BorrowTree) (tag : Memory.BorTag) (index start : UniIndex) (node : TreeNode) (strongest : IdempotentForeignAccess) (tagged : tree.indexOfTag tag = some index) (present : tree.nodes.get index = some node) (unexposed : node.isExposed = false) (absent : ∀ (position : Nat) (valid : position < tree.locations.entries.size), tree.locations.entries[position].data.perms.get index = none) (protections : ProtectedTags) :
                                                                                                                                                                                              have after := (Miri.TreeBorrows.BorrowTree.updateSifaAfterRetag✝ tree start strongest).fst; after.releaseProtector tag protections = { tree := after, status := ProtectorReleaseStatus.Released }

                                                                                                                                                                                              The ancestor SIFA stage preserves the exact facts needed to release a fresh, lazy, unexposed child, including on every existing byte partition.

                                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Release.concrete_zero_eq (tree : BorrowTree) (parentTag tag : Memory.BorTag) (index parent : UniIndex) (parentNode : TreeNode) (mapping : UniKeyMap Memory.BorTag) (inserted : tree.tagMapping.insert tag = UniKeyMapInsertResult.Inserted mapping index) (tagged : tree.tagMapping.get parentTag = some parent) (present : tree.nodes.get parent = some parentNode) (vacant : tree.nodes.get index = none) (offset : ABI.Size) (initial : Tree.LocationState) :
                                                                                                                                                                                              have node := { tag := tag, parent := some parent, defaultInitialPermission := Permission.ReservedFrz false, defaultInitialSifa := IdempotentForeignAccess.None }; have staged := { tagMapping := mapping, nodes := Append.attachedNodes tree.nodes index parent parentNode node, locations := tree.locations, roots := tree.roots }; have result := Miri.TreeBorrows.BorrowTree.updateSifaAfterRetag✝ staged parent IdempotentForeignAccess.None; tree.newChild offset (Memory.ProvenanceExtra.concrete parentTag) tag (DataStructures.DedupRangeMap.new ABI.Size.ZERO initial) (Permission.ReservedFrz false) true = { tree := result.fst, outcome := result.snd }

                                                                                                                                                                                              Implementation-facing source equation for a concrete zero child. The insertion equation is discharged from raw freshness/pool data by clients.

                                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Release.concrete_zero_release (tree : BorrowTree) (parentTag tag : Memory.BorTag) (index parent : UniIndex) (parentNode : TreeNode) (mapping : UniKeyMap Memory.BorTag) (inserted : tree.tagMapping.insert tag = UniKeyMapInsertResult.Inserted mapping index) (tagged : tree.tagMapping.get parentTag = some parent) (present : tree.nodes.get parent = some parentNode) (vacant : tree.nodes.get index = none) (newTag : mapping.get tag = some index) (absent : ∀ (position : Nat) (valid : position < tree.locations.entries.size), tree.locations.entries[position].data.perms.get index = none) (offset : ABI.Size) (initial : Tree.LocationState) (protections : ProtectedTags) :
                                                                                                                                                                                              have after := (tree.newChild offset (Memory.ProvenanceExtra.concrete parentTag) tag (DataStructures.DedupRangeMap.new ABI.Size.ZERO initial) (Permission.ReservedFrz false) true).tree; after.releaseProtector tag protections = { tree := after, status := ProtectorReleaseStatus.Released }

                                                                                                                                                                                              The freshly inserted concrete zero child can be released without changing its post-constructor tree. Initial node vacancy and permission vacancy are separate facts; no release or byte-access success is assumed.

                                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Release.wildcard_zero_eq (tree : BorrowTree) (tag : Memory.BorTag) (index : UniIndex) (mapping : UniKeyMap Memory.BorTag) (inserted : tree.tagMapping.insert tag = UniKeyMapInsertResult.Inserted mapping index) (offset : ABI.Size) (initial : Tree.LocationState) :
                                                                                                                                                                                              tree.newChild offset Memory.ProvenanceExtra.wildcard tag (DataStructures.DedupRangeMap.new ABI.Size.ZERO initial) (Permission.ReservedFrz false) true = { tree := { tagMapping := mapping, nodes := tree.nodes.insert index { tag := tag, parent := none, defaultInitialPermission := Permission.ReservedFrz false, defaultInitialSifa := IdempotentForeignAccess.None }, locations := tree.locations, roots := tree.roots.push index }, outcome := Except.ok () }

                                                                                                                                                                                              Exact lazy-root result for the wildcard zero-size source constructor.

                                                                                                                                                                                              theorem Miri.TreeBorrows.BorrowTree.ZeroProtection.Release.wildcard_zero_release (tree : BorrowTree) (tag : Memory.BorTag) (index : UniIndex) (mapping : UniKeyMap Memory.BorTag) (inserted : tree.tagMapping.insert tag = UniKeyMapInsertResult.Inserted mapping index) (newTag : mapping.get tag = some index) (absent : ∀ (position : Nat) (valid : position < tree.locations.entries.size), tree.locations.entries[position].data.perms.get index = none) (offset : ABI.Size) (initial : Tree.LocationState) (protections : ProtectedTags) :

                                                                                                                                                                                              Ending the fresh wildcard-root protector leaves its zero-size constructor result unchanged. Node vacancy and permission vacancy are kept independent.

                                                                                                                                                                                              The actual first full-range write on fresh allocation-owned provenance. The existing global protector map is arbitrary.