Skip to main content

ostd/specs/mm/page_table/cursor/
invariant_preservation_lemmas.rs

1/// CursorOwner-level preservation lemmas for transient `MetaRegionOwners`
2/// updates that affect at most one slot. Map/unmap operations insert or
3/// remove a tree path from a frame slot and preserve the cursor's
4/// metadata-region soundness.
5///
6/// Both directions are now proven: `metaregion_preserved_under_path_insert`
7/// (used by `map`, the huge-page split) and
8/// `metaregion_preserved_under_path_remove` (used by the `take_next`
9/// frame-unmap preservation proof).
10///
11/// Each lemma here lifts [`EntryOwner`]-level preservation facts (from
12/// `entry_owners.rs`) over the full cursor tree.
13use vstd::prelude::*;
14use vstd_extra::{ghost_tree::*, ownership::*};
15
16use crate::specs::{
17    arch::*,
18    mm::{
19        frame::{
20            mapping::frame_to_index, meta_owners::PageUsage, meta_region_owners::MetaRegionOwners,
21        },
22        page_table::{
23            Mapping,
24            cursor::owners::{CursorContinuation, CursorOwner},
25            node::entry_owners::EntryOwner,
26            owners::*,
27        },
28    },
29};
30
31use crate::mm::{PagingConstsTrait, frame::meta::REF_COUNT_UNUSED, page_size, page_table::*};
32
33verus! {
34
35impl<'rcu, C: PageTableConfig> CursorOwner<'rcu, C> {
36    /// Tree-wide predicate: no page-table node in either the cursor's tree
37    /// children or its continuation path has metadata slot index `idx`.
38    /// Used as the "sanity" precondition of the path-insert preservation
39    /// lemma: the only kind of entry it can touch with the new path is a
40    /// frame. Callers satisfy it by observing that page-table node metadata
41    /// lives in `FRAME_METADATA_RANGE`, which is disjoint from any data-frame
42    /// paddr (where `paths_in_pt` inserts happen).
43    pub open spec fn no_node_at_idx(self, idx: int) -> bool {
44        &&& self.map_full_tree(
45            |e: EntryOwner<C>, _p: TreePath<NR_ENTRIES>|
46                e.is_node() && e.meta_slot_paddr() is Some ==> frame_to_index(
47                    e.meta_slot_paddr()->0,
48                ) != idx,
49        )
50        &&& forall|i: int|
51            #![trigger self.continuations[i]]
52            self.level - 1 <= i < C::NR_LEVELS ==> {
53                let e = self.continuations[i].entry_own;
54                e.is_node() && e.meta_slot_paddr() is Some ==> frame_to_index(
55                    e.meta_slot_paddr()->0,
56                ) != idx
57            }
58    }
59
60    /// Pointwise conjunction of two tree-wide predicates: if `self.map_full_tree(f)`
61    /// and `self.map_full_tree(guard)` hold, then `self.map_full_tree(f && guard)`
62    /// holds. A thin wrapper around `OwnerSubtree::lemma_subtree_satisfies_implies_and` applied per
63    /// continuation + per child; extracted so callers don't have to re-derive
64    /// the same nested `assert forall ... by { lemma_subtree_satisfies_implies_and(...) }` block.
65    pub proof fn and_map_full_tree(
66        self,
67        f: spec_fn(EntryOwner<C>, TreePath<NR_ENTRIES>) -> bool,
68        guard: spec_fn(EntryOwner<C>, TreePath<NR_ENTRIES>) -> bool,
69    )
70        requires
71            self.inv(),
72            self.map_full_tree(f),
73            self.map_full_tree(guard),
74        ensures
75            self.map_full_tree(|e: EntryOwner<C>, p: TreePath<NR_ENTRIES>| f(e, p) && guard(e, p)),
76    {
77        C::lemma_paging_consts_properties();
78        C::lemma_page_table_config_constant_properties();
79        let combined = |e: EntryOwner<C>, p: TreePath<NR_ENTRIES>| f(e, p) && guard(e, p);
80        assert forall|i: int|
81            #![trigger self.continuations[i]]
82            self.level - 1 <= i < C::NR_LEVELS implies self.continuations[i].map_children(
83            combined,
84        ) by {
85            reveal(CursorContinuation::map_children);
86            let cont = self.continuations[i];
87            reveal(CursorContinuation::inv_children);
88            assert forall|j: int|
89                #![trigger cont.children[j]]
90                0 <= j < cont.children.len()
91                    && cont.children[j] is Some implies cont.children[j].unwrap().subtree_satisfies(
92                cont.path().push_tail(j),
93                combined,
94            ) by {
95                cont.lemma_inv_children_unroll(j);
96                OwnerSubtree::lemma_subtree_satisfies_implies_and(
97                    cont.children[j].unwrap(),
98                    cont.path().push_tail(j),
99                    f,
100                    guard,
101                    combined,
102                );
103            };
104        };
105    }
106
107    /// Discharge `no_node_at_idx(changed_idx)` from the observation that
108    /// `changed_idx` is not a page-table slot. Active node entries always
109    /// occupy metadata slots whose usage is `PageTable`, so any node in the
110    /// cursor tree must have a different slot index than `changed_idx`.
111    ///
112    /// Callers doing a `paths_in_pt.insert` at a frame's data-slot
113    /// (e.g., `map` and the huge-page split) use this helper to
114    /// satisfy the precondition of
115    /// [`Self::metaregion_preserved_under_path_insert`].
116    pub proof fn no_node_at_idx_from_slot_key(self, regions: MetaRegionOwners, changed_idx: int)
117        requires
118            self.inv(),
119            regions.inv(),
120            self.metaregion_sound(regions),
121            regions.contains(changed_idx),
122            regions.slot_owners[changed_idx].usage !is PageTable,
123        ensures
124            self.no_node_at_idx(changed_idx),
125    {
126        C::lemma_paging_consts_properties();
127        C::lemma_page_table_config_constant_properties();
128        let msp = PageTableOwner::<C>::metaregion_sound_pred(regions);
129        let target = |e: EntryOwner<C>, _p: TreePath<NR_ENTRIES>|
130            e.is_node() && e.meta_slot_paddr() is Some ==> frame_to_index(
131                e.meta_slot_paddr().unwrap(),
132            ) != changed_idx;
133
134        self.lemma_map_children_implies(msp, target);
135
136        assert forall|i: int|
137            #![trigger self.continuations[i]]
138            self.level - 1 <= i < C::NR_LEVELS implies {
139            let e = self.continuations[i].entry_own;
140            e.is_node() && e.meta_slot_paddr() is Some ==> frame_to_index(
141                e.meta_slot_paddr().unwrap(),
142            ) != changed_idx
143        } by {
144            self.lemma_cont_entry_metaregion_at(regions, i);
145            let entry = self.continuations[i].entry_own;
146            if entry.is_node() && entry.meta_slot_paddr() is Some {
147                let idx = frame_to_index(entry.meta_slot_paddr().unwrap());
148                if idx == changed_idx {
149                    assert(false);
150                }
151            }
152        };
153    }
154
155    /// Preservation of the cursor-level metaregion invariants when the only
156    /// change to `regions` is the **insertion** of a new path into the
157    /// `paths_in_pt` set at a single slot.
158    pub proof fn metaregion_preserved_under_path_insert(
159        self,
160        regions0: MetaRegionOwners,
161        regions1: MetaRegionOwners,
162        changed_idx: int,
163        new_path: TreePath<NR_ENTRIES>,
164    )
165        requires
166            self.inv(),
167            self.metaregion_sound(regions0),
168            regions0.inv(),
169            regions0.contains(changed_idx),
170            regions1.slots == regions0.slots,
171            regions1.slot_owners.dom() =~= regions0.slot_owners.dom(),
172            forall|i: int|
173                #![trigger regions1.slot_owners[i]]
174                i != changed_idx ==> regions0.slot_owners[i] == regions1.slot_owners[i],
175            regions1.slot_owners[changed_idx].same_permissions(regions0.slot_owners[changed_idx]),
176            regions1.slot_owners[changed_idx].slot_vaddr
177                == regions0.slot_owners[changed_idx].slot_vaddr,
178            regions1.slot_owners[changed_idx].usage == regions0.slot_owners[changed_idx].usage,
179            regions1.slot_owners[changed_idx].paths_in_pt
180                == regions0.slot_owners[changed_idx].paths_in_pt.insert(new_path),
181            self.no_node_at_idx(changed_idx),
182        ensures
183            self.metaregion_sound(regions1),
184    {
185        C::lemma_paging_consts_properties();
186        C::lemma_page_table_config_constant_properties();
187        let f = PageTableOwner::<C>::metaregion_sound_pred(regions0);
188        let g = PageTableOwner::<C>::metaregion_sound_pred(regions1);
189        let guard = |entry: EntryOwner<C>, _p: TreePath<NR_ENTRIES>|
190            entry.is_node() && entry.meta_slot_paddr() is Some ==> frame_to_index(
191                entry.meta_slot_paddr().unwrap(),
192            ) != changed_idx;
193        let f_strong = |entry: EntryOwner<C>, path: TreePath<NR_ENTRIES>|
194            f(entry, path) && guard(entry, path);
195
196        self.and_map_full_tree(f, guard);
197        assert(OwnerSubtree::implies(f_strong, g)) by {
198            assert forall|entry: EntryOwner<C>, path: TreePath<NR_ENTRIES>|
199                entry.inv() && f_strong(entry, path) implies #[trigger] g(entry, path) by {
200                if entry.is_frame() {
201                    let pa = entry.frame().mapped_pa;
202                    let idx = frame_to_index(pa);
203                    assert(regions0.slots[idx] == regions1.slots[idx]);
204                    assert(regions0.slot_owners[idx].metadata_perm.id()
205                        == regions1.slot_owners[idx].metadata_perm.id());
206                    C::lemma_perm_well_formed_with_region_preserved(
207                        pa,
208                        Tracked(entry.frame_permission()),
209                        regions0,
210                        regions1,
211                    );
212                }
213            };
214        };
215        self.lemma_map_children_implies(f_strong, g);
216
217        reveal(CursorOwner::path_metaregion_sound);
218        assert forall|i: int|
219            #![trigger self.continuations[i]]
220            self.level - 1 <= i
221                < C::NR_LEVELS implies self.continuations[i].entry_own.metaregion_sound(
222            regions1,
223        ) by {
224            let cont_entry = self.continuations[i].entry_own;
225            if cont_entry.meta_slot_paddr() is Some {
226                // Same sub-page bridge as above (continuations branch).
227                cont_entry.lemma_metaregion_sound_one_slot_changed(regions0, regions1, changed_idx);
228            }
229        };
230    }
231
232    /// Tree-wide guard for the **removal** of `removed_path` from
233    /// `paths_in_pt[changed_idx]`. Mirror of [`Self::no_node_at_idx`] but
234    /// also rules out any *frame* entry that still maps `changed_idx`
235    /// through exactly `removed_path` — removing that path would break
236    /// such an entry's `metaregion_sound` (`paths_in_pt.contains(path)`).
237    /// A node at `changed_idx` is also excluded (its `paths_in_pt` is a
238    /// singleton, so removal would falsify `== set![path]`). Callers
239    /// (the `unmap` site) satisfy this because the entry whose path is
240    /// being removed has just left the cursor tree.
241    pub open spec fn path_removable_at_idx(
242        self,
243        idx: int,
244        removed_path: TreePath<NR_ENTRIES>,
245    ) -> bool {
246        &&& self.map_full_tree(
247            |e: EntryOwner<C>, _p: TreePath<NR_ENTRIES>|
248                e.meta_slot_paddr() is Some && frame_to_index(e.meta_slot_paddr()->0) == idx
249                    ==> !e.is_node() && (e.is_frame() ==> e.path != removed_path),
250        )
251        &&& forall|i: int|
252            #![trigger self.continuations[i]]
253            self.level - 1 <= i < C::NR_LEVELS ==> {
254                let e = self.continuations[i].entry_own;
255                e.meta_slot_paddr() is Some && frame_to_index(e.meta_slot_paddr()->0) == idx
256                    ==> !e.is_node() && (e.is_frame() ==> e.path != removed_path)
257            }
258    }
259
260    /// Tree-wide predicate: no *frame* entry in the cursor tree has
261    /// tree path exactly `removed_path`. After `unmap`'s
262    /// `replace_cur_entry(Child::None)`, the entry at the cursor path
263    /// (`== removed_path`) is absent, so by tree-path correctness no
264    /// frame entry can carry that path. This is the one structural
265    /// residual of the `paths_in_pt`-removal refactor.
266    pub open spec fn no_frame_with_path(self, removed_path: TreePath<NR_ENTRIES>) -> bool {
267        &&& self.map_full_tree(
268            |e: EntryOwner<C>, _p: TreePath<NR_ENTRIES>| e.is_frame() ==> e.path != removed_path,
269        )
270        &&& forall|i: int|
271            #![trigger self.continuations[i]]
272            self.level - 1 <= i < C::NR_LEVELS ==> {
273                let e = self.continuations[i].entry_own;
274                e.is_frame() ==> e.path != removed_path
275            }
276    }
277
278    /// Establishes [`Self::no_frame_with_path`] from the observation that
279    /// **no current view mapping starts at `vaddr_of(removed_path)`**.
280    ///
281    /// This is the standalone "lift `path_correct_pred` + uniqueness over
282    /// the cursor tree" lemma the `unmap` site needs. Each continuation
283    /// child subtree is `pt_inv` + path-correct (via
284    /// [`PageTableOwner::lemma_pt_inv_implies_path_correct`]), and its mappings
285    /// all bubble up into `self@.mappings`; so by
286    /// [`PageTableOwner::lemma_no_frame_with_path_rec`] a frame entry carrying
287    /// `removed_path` would force a mapping starting at
288    /// `vaddr_of(removed_path)` into `self@.mappings` — exactly what the
289    /// hypothesis forbids. Continuation *entries* are nodes, so the
290    /// continuations conjunct is vacuous.
291    pub proof fn no_frame_with_path_from_no_view_mapping(self, removed_path: TreePath<NR_ENTRIES>)
292        requires
293            self.inv(),
294            forall|m: Mapping|
295                #![trigger self@.mappings.contains(m)]
296                self@.mappings.contains(m) ==> m.va_range.start != vaddr_of::<C>(removed_path),
297        ensures
298            self.no_frame_with_path(removed_path),
299    {
300        C::lemma_paging_consts_properties();
301        C::lemma_page_table_config_constant_properties();
302        broadcast use CursorContinuation::group_lemmas;
303
304        let g = |e: EntryOwner<C>, _p: TreePath<NR_ENTRIES>|
305            e.is_frame() ==> e.path != removed_path;
306
307        // map_full_tree(g): each continuation child subtree is pt_inv,
308        // path-correct, and its mappings sit inside self@.mappings.
309        assert forall|i: int|
310            #![trigger self.continuations[i]]
311            self.level - 1 <= i < C::NR_LEVELS implies self.continuations[i].map_children(g) by {
312            reveal(CursorContinuation::map_children);
313            self.lemma_inv_continuation(i);
314            let cont = self.continuations[i];
315            reveal(CursorContinuation::inv_children);
316            assert forall|j: int|
317                #![trigger cont.children[j]]
318                0 <= j < cont.children.len()
319                    && cont.children[j] is Some implies cont.children[j].unwrap().subtree_satisfies(
320                cont.path().push_tail(j),
321                g,
322            ) by {
323                cont.lemma_inv_children_unroll(j);
324                cont.lemma_pt_inv_children_unroll(j);
325                cont.lemma_inv_children_rel_unroll(j);
326                let child = cont.children[j].unwrap();
327                let child_path = cont.path().push_tail(j);
328                // child.value.path == child_path (inv_children_rel) and
329                // child.value.path.inv() (EntryOwner::inv).
330                // L1: pt_inv ⟹ tree-wide path correctness.
331                PageTableOwner::<C>::lemma_pt_inv_implies_path_correct(child, child_path);
332                // Every mapping of this child subtree is in self@.mappings.
333                assert forall|m: Mapping|
334                    #![trigger self@.mappings.contains(m)]
335                    PageTableOwner(child).view_rec(child_path).contains(
336                        m,
337                    ) implies self@.mappings.contains(m) by {
338                    self.lemma_view_mappings_intro(m, i);
339                };
340                // L-rec: no frame entry in this subtree carries removed_path.
341                PageTableOwner(child).lemma_no_frame_with_path_rec(
342                    child_path,
343                    removed_path,
344                    self@.mappings,
345                );
346            };
347        };
348
349        // Continuation entries are page-table nodes ⟹ not frames.
350        assert forall|i: int|
351            #![trigger self.continuations[i]]
352            self.level - 1 <= i < C::NR_LEVELS implies {
353            let e = self.continuations[i].entry_own;
354            e.is_frame() ==> e.path != removed_path
355        } by {
356            self.lemma_inv_continuation(i);
357        };
358    }
359
360    /// Bridge: `path_removable_at_idx` follows from the (mechanically
361    /// dischargeable) no-node-at-idx fact plus the structural
362    /// no-frame-with-`removed_path` fact. Per entry mapping `idx`:
363    /// `no_node_at_idx` forces `!is_node`, and `no_frame_with_path`
364    /// forces `is_frame ==> path != removed_path` — exactly the
365    /// `path_removable_at_idx` conjunction.
366    pub proof fn path_removable_from_no_node_and_no_frame_path(
367        self,
368        idx: int,
369        removed_path: TreePath<NR_ENTRIES>,
370    )
371        requires
372            self.inv(),
373            self.no_node_at_idx(idx),
374            self.no_frame_with_path(removed_path),
375        ensures
376            self.path_removable_at_idx(idx, removed_path),
377    {
378        C::lemma_paging_consts_properties();
379        C::lemma_page_table_config_constant_properties();
380        let nn = |e: EntryOwner<C>, _p: TreePath<NR_ENTRIES>|
381            e.is_node() && e.meta_slot_paddr() is Some ==> frame_to_index(
382                e.meta_slot_paddr().unwrap(),
383            ) != idx;
384        let nf = |e: EntryOwner<C>, _p: TreePath<NR_ENTRIES>|
385            e.is_frame() ==> e.path != removed_path;
386        let r = |e: EntryOwner<C>, _p: TreePath<NR_ENTRIES>|
387            e.meta_slot_paddr() is Some && frame_to_index(e.meta_slot_paddr().unwrap()) == idx
388                ==> !e.is_node() && (e.is_frame() ==> e.path != removed_path);
389
390        // Pointwise: nn(e) && nf(e) ==> r(e).
391        // map_full_tree halves -> combined -> r.
392        self.and_map_full_tree(nn, nf);
393        self.lemma_map_children_implies(
394            |e: EntryOwner<C>, p: TreePath<NR_ENTRIES>| nn(e, p) && nf(e, p),
395            r,
396        );
397
398        // Continuation-entry halves combine directly.
399        assert forall|i: int|
400            #![trigger self.continuations[i]]
401            self.level - 1 <= i < C::NR_LEVELS implies {
402            let e = self.continuations[i].entry_own;
403            e.meta_slot_paddr() is Some && frame_to_index(e.meta_slot_paddr().unwrap()) == idx
404                ==> !e.is_node() && (e.is_frame() ==> e.path != removed_path)
405        } by {
406            let e = self.continuations[i].entry_own;
407        }
408    }
409
410    /// Preservation of the cursor-level metaregion invariants when the
411    /// only change to `regions` is the **removal** of `removed_path`
412    /// from the `paths_in_pt` set at a single slot. Dual of
413    /// [`Self::metaregion_preserved_under_path_insert`], used by frame unmapping.
414    ///
415    /// Removal is *not* monotone (unlike insert): the guard
416    /// [`Self::path_removable_at_idx`] is what makes it sound — no live
417    /// tree entry still needs `removed_path` at `changed_idx`.
418    pub proof fn metaregion_preserved_under_path_remove(
419        self,
420        regions0: MetaRegionOwners,
421        regions1: MetaRegionOwners,
422        changed_idx: int,
423        removed_path: TreePath<NR_ENTRIES>,
424    )
425        requires
426            self.inv(),
427            self.metaregion_sound(regions0),
428            regions0.inv(),
429            regions0.contains(changed_idx),
430            regions1.slots == regions0.slots,
431            regions1.slot_owners.dom() =~= regions0.slot_owners.dom(),
432            forall|i: int|
433                #![trigger regions1.slot_owners[i]]
434                i != changed_idx ==> regions0.slot_owners[i] == regions1.slot_owners[i],
435            regions1.slot_owners[changed_idx].same_permissions(regions0.slot_owners[changed_idx]),
436            regions1.slot_owners[changed_idx].slot_vaddr
437                == regions0.slot_owners[changed_idx].slot_vaddr,
438            regions1.slot_owners[changed_idx].usage == regions0.slot_owners[changed_idx].usage,
439            regions1.slot_owners[changed_idx].paths_in_pt
440                == regions0.slot_owners[changed_idx].paths_in_pt.remove(removed_path),
441            self.path_removable_at_idx(changed_idx, removed_path),
442        ensures
443            self.metaregion_sound(regions1),
444    {
445        C::lemma_paging_consts_properties();
446        C::lemma_page_table_config_constant_properties();
447        let f = PageTableOwner::<C>::metaregion_sound_pred(regions0);
448        let g = PageTableOwner::<C>::metaregion_sound_pred(regions1);
449        let guard = |entry: EntryOwner<C>, _p: TreePath<NR_ENTRIES>|
450            entry.meta_slot_paddr() is Some && frame_to_index(entry.meta_slot_paddr().unwrap())
451                == changed_idx ==> !entry.is_node() && (entry.is_frame() ==> entry.path
452                != removed_path);
453        let f_strong = |entry: EntryOwner<C>, path: TreePath<NR_ENTRIES>|
454            f(entry, path) && guard(entry, path);
455
456        self.and_map_full_tree(f, guard);
457        assert(OwnerSubtree::implies(f_strong, g)) by {
458            assert forall|entry: EntryOwner<C>, path: TreePath<NR_ENTRIES>|
459                entry.inv() && f_strong(entry, path) implies #[trigger] g(entry, path) by {
460                if entry.is_frame() {
461                    let pa = entry.frame().mapped_pa;
462                    let idx = frame_to_index(pa);
463                    assert(regions0.slots[idx] == regions1.slots[idx]);
464                    assert(regions0.slot_owners[idx].metadata_perm.id()
465                        == regions1.slot_owners[idx].metadata_perm.id());
466                    C::lemma_perm_well_formed_with_region_preserved(
467                        pa,
468                        Tracked(entry.frame_permission()),
469                        regions0,
470                        regions1,
471                    );
472                }
473            };
474        };
475        self.lemma_map_children_implies(f_strong, g);
476
477        reveal(CursorOwner::path_metaregion_sound);
478        assert forall|i: int|
479            #![trigger self.continuations[i]]
480            self.level - 1 <= i
481                < C::NR_LEVELS implies self.continuations[i].entry_own.metaregion_sound(
482            regions1,
483        ) by {
484            let cont_entry = self.continuations[i].entry_own;
485            if cont_entry.meta_slot_paddr() is Some {
486                let eidx = frame_to_index(cont_entry.meta_slot_paddr().unwrap());
487                if eidx != changed_idx {
488                    cont_entry.lemma_metaregion_sound_one_slot_changed(
489                        regions0,
490                        regions1,
491                        changed_idx,
492                    );
493                }
494            }
495        };
496    }
497
498    /// Packages the `take_next` frame-unmap preservation proof after
499    /// `paths_in_pt` removes the unmapped frame path from one metadata slot.
500    pub proof fn take_next_remove_path_preserves_metaregion(
501        self,
502        owner_before_replace: Self,
503        regions0: MetaRegionOwners,
504        regions1: MetaRegionOwners,
505        removed_idx: int,
506        removed_path: TreePath<NR_ENTRIES>,
507        target: Mapping,
508    )
509        requires
510            self.inv(),
511            owner_before_replace.inv(),
512            owner_before_replace.in_barrier_va(),
513            self.metaregion_sound(regions0),
514            regions0.inv(),
515            regions0.contains(removed_idx),
516            regions0.slot_owners[removed_idx].usage !is PageTable,
517            self@.mappings == owner_before_replace@.mappings - PageTableOwner(
518                owner_before_replace.cur_subtree(),
519            )@.mappings,
520            PageTableOwner(owner_before_replace.cur_subtree())@.mappings == set![target],
521            owner_before_replace.cur_subtree().value().path == removed_path,
522            regions1.slots == regions0.slots,
523            regions1.slot_owners.dom() =~= regions0.slot_owners.dom(),
524            forall|i: int|
525                #![trigger regions1.slot_owners[i]]
526                i != removed_idx ==> regions0.slot_owners[i] == regions1.slot_owners[i],
527            regions1.slot_owners[removed_idx].same_permissions(regions0.slot_owners[removed_idx]),
528            regions1.slot_owners[removed_idx].slot_vaddr
529                == regions0.slot_owners[removed_idx].slot_vaddr,
530            regions1.slot_owners[removed_idx].usage == regions0.slot_owners[removed_idx].usage,
531            regions1.slot_owners[removed_idx].paths_in_pt
532                == regions0.slot_owners[removed_idx].paths_in_pt.remove(removed_path),
533        ensures
534            self.metaregion_sound(regions1),
535    {
536        C::lemma_paging_consts_properties();
537        C::lemma_page_table_config_constant_properties();
538        self.no_node_at_idx_from_slot_key(regions0, removed_idx);
539
540        owner_before_replace.lemma_cur_subtree_eq_filtered_mappings_path();
541
542        let ghost sv = vaddr_of::<C>(removed_path) as int;
543        let ghost sz = page_size::<C>(owner_before_replace.level) as int;
544        assert(sz > 0) by {
545            crate::specs::mm::page_table::cursor::page_size_lemmas::lemma_page_size_ge_base::<C>(
546                owner_before_replace.level,
547            );
548        };
549        assert forall|mm: Mapping| #[trigger] self@.mappings.contains(mm) implies mm.va_range.start
550            != sv by {};
551
552        self.no_frame_with_path_from_no_view_mapping(removed_path);
553        self.path_removable_from_no_node_and_no_frame_path(removed_idx, removed_path);
554        self.metaregion_preserved_under_path_remove(regions0, regions1, removed_idx, removed_path);
555    }
556}
557
558} // verus!