Finite semantic port of Miri's tree_borrows/unimap.rs. UniKeyMap keeps
the source's reusable u32 index pool; UniValMap keeps optional values in an
array indexed by the same value. Large collections are represented by Lean
arrays, but all observable insertion/removal behavior is explicit.
@[instance_reducible]
@[instance_reducible]
Equations
Equations
- Miri.TreeBorrows.instReprUniIndex.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "idx" ++ Std.Format.text " := " ++ (Std.Format.nest 7 (repr x✝.idx)).group) " }"
Instances For
@[instance_reducible]
Equations
- IndexSpaceExhausted (active : Nat) : UniKeyMapError
Instances For
@[instance_reducible]
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
@[instance_reducible]
Equations
@[instance_reducible]
instance
Miri.TreeBorrows.instDecidableEqUniKeyMap
{α✝ : Type}
[DecidableEq α✝]
:
DecidableEq (UniKeyMap α✝)
def
Miri.TreeBorrows.instDecidableEqUniKeyMap.decEq
{α✝ : Type}
[DecidableEq α✝]
(x✝ x✝¹ : UniKeyMap α✝)
:
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
@[instance_reducible]
Equations
@[instance_reducible]
Equations
- Inserted {α : Type} (map : UniKeyMap α) (index : UniIndex) : UniKeyMapInsertResult α
- DuplicateKeyAfterReplacement {α : Type} (map : UniKeyMap α) (index : UniIndex) : UniKeyMapInsertResult α
- Error {α : Type} (map : UniKeyMap α) (error : UniKeyMapError) : UniKeyMapInsertResult α
Instances For
@[instance_reducible]
Equations
def
Miri.TreeBorrows.instReprUniKeyMapInsertResult.repr
{α✝ : Type}
[Repr α✝]
:
UniKeyMapInsertResult α✝ → Nat → Std.Format
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- map.get key = Option.map Prod.snd (Array.find? (fun (entry : α × Miri.TreeBorrows.UniIndex) => entry.fst == key) map.mapping)
Instances For
Equations
- map.containsKey key = (map.get key).isSome
Instances For
Source insertion pops a reusable index first, otherwise converts the current active map length to u32. A duplicate key preserves Rust HashMap's replacement mutation before returning the source panic as an explicit result.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- map.getOrInsert key = match map.get key with | some index => Miri.TreeBorrows.UniKeyMapInsertResult.Inserted map index | none => map.insert key
Instances For
@[instance_reducible]
instance
Miri.TreeBorrows.instDecidableEqUniValMap
{α✝ : Type}
[DecidableEq α✝]
:
DecidableEq (UniValMap α✝)
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[instance_reducible]
Equations
@[instance_reducible]
Equations
Equations
- Miri.TreeBorrows.UniValMap.extendTo data length = data ++ Array.replicate (length - data.size) none
Instances For
Canonical representation for source UniValMap::equivalent equality.
Rust treats trailing None slots as absent when comparing maps; trimming them
before Lean's structural range-map comparison preserves that behavior.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- map.isEmpty = map.data.all Option.isNone