add api for slice/vec/array - #1237
Open
oliver-butterley wants to merge 8 commits into
Open
Conversation
oliver-butterley
marked this pull request as ready for review
July 28, 2026 15:32
Collaborator
Author
|
TODO: /-- Map a function over an `Array`, preserving the length. -/
def Array.map {α : Type u} {β : Type v} {n : Usize} (f : α → β) (a : Array α n) : Array β n :=
⟨a.val.map f, by simp [a.property]⟩EDIT: this def and two lemmas added |
sonmarcho
reviewed
Aug 19, 2026
| theorem Array.val_make {α : Type u} (n : Usize) (l : List α) (h : l.length = n) : | ||
| (Array.make n l h).val = l := rfl | ||
|
|
||
| @[scalar_tac Array.make n l h, grind =] |
sonmarcho
reviewed
Aug 19, 2026
| Array.make n a.val h = a := rfl | ||
|
|
||
| theorem Array.make_inj {α : Type u} {n : Usize} (l₁ l₂ : List α) (h₁ : l₁.length = n) | ||
| (h₂ : l₂.length = n) : Array.make n l₁ h₁ = Array.make n l₂ h₂ ↔ l₁ = l₂ := |
Member
There was a problem hiding this comment.
I think grind has an attribute for this kind of injectivity lemmas
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds various basic results for slice/vec/array that were not yet present in Aeneas but fit the pattern of what is included there and which help to make smooth proofs of spec theorems downstream.