Skip to content

Micro_Rust_Std_Lib: add verified slice and vector operations - #267

Open
nagyors wants to merge 1 commit into
awslabs:mainfrom
jonasmittun:slice-expansion
Open

Micro_Rust_Std_Lib: add verified slice and vector operations#267
nagyors wants to merge 1 commit into
awslabs:mainfrom
jonasmittun:slice-expansion

Conversation

@nagyors

@nagyors nagyors commented Aug 8, 2026

Copy link
Copy Markdown

Issue #17: Slice expansion.

Extends Micro_Rust_Std_Lib's StdLib_Slice.thy with a batch of verified slice and vector utility functions. Each new function follows the existing pattern, with crush/crush_base discharging the proofs.

Added:

  • slice_swap / vec_swap — swap two elements by index
  • slice_contains / vec_contains — membership test
  • slice_copy_from_slice — overwrite a slice from another slice of equal length
  • slice_reverse — in-place reversal
  • slice_fill — fill a slice with a given value
  • slice_split_at — split a list into two at a given index
  • vec_push / vec_pop — push/pop on a fixed-capacity vector, returning Result/Option to signal capacity/emptiness
  • slice_sort — in-place sort for linorder element types

Each is registered under micro_rust_notation so it's callable from µRust source using its Rust standard-library name (swap, contains, fill, push, pop, sort, etc.).

Test

Ran make build to ensure the project builds.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant