On this page
Verada.Containers.Formal.Maps
A fixed-capacity insertion-order table from keys to values.
Read the family guide for representation, selection and resource rules. The complete declaration page retains exact signatures/contracts; the source specification is the implementation baseline.
Availability and ownership
Positional reads need <=Length; keyed Value needs Contains. Insert requires absence/room; Replace presence. There is no Remove operation. Iteration yields keys.
A client proof uses these contracts without proving the body again (see library assurance). Global => null excludes package-global effects, not changes made through an in out argument.
Import and instantiate
Place the declaration in a declarative part, with the actuals your program needs.
with Verada.Containers.Formal.Maps;
package Instance_Name is new Verada.Containers.Formal.Maps (Integer, Integer, 8);import Verada.Containers.Formal.Maps;
package Instance_Name = new Verada.Containers.Formal.Maps<Integer, Integer, 8>;
A Vibe module imports this unit's names with from Verada.Containers.Formal.Maps import Name; see library use across syntaxes. In Varc, keep each name's declared spelling and write & on arguments the call changes.
Contract and lifecycle reading
A Pre condition is the caller's obligation; a Post is what a normal return guarantees. What a postcondition does not state, a client cannot assume. Ghost functions are for contracts and ghost code. The family guide describes copying, lifetime, order and cost.
API 001
Generic formals (declaration) — Generic actuals establish this instance's nominal types and declared operations. Private formals require suitable definite nonlimited actuals; capacity/comparison/float restrictions are shown below. Defaulted comparison is resolved from the actual type, not an automatic proof of ordering laws.
Declared interface:
generic
type Key_Type is private;
type Element_Type is private;
Capacity : Positive;API 002
Extended_Index (declaration) — Capacity-bounded length/search-result domain including zero. A nonzero search result still needs the declared existence property.
Declared interface:
subtype Extended_Index is Natural range 0 .. Capacity;API 003
Index_Type (declaration) — Capacity-bounded positive position domain; a read must additionally establish the position is at most current Length.
Declared interface:
subtype Index_Type is Positive range 1 .. Capacity;API 004
Map (declaration) — Copyable fixed-capacity insertion-order key/value state, initially empty; no automatic growth or key deletion is supplied.
Declared interface:
type Map is private
with Default_Initial_Condition => Length (Map) = 0,
Iterable => (First => Iter_First, Next => Iter_Next, Has_Element => Iter_Has_Element, Element => Iter_Key);API 005
Length (declaration) — Observe the logical length/cardinality, not backing capacity or physical allocation size.
API 006
Key (declaration) — Read the key at a present numeric position, not the value associated with an arbitrary key.
Before this operation, establish:
Index <= Length (Container)API 007
Key_Models (declaration) — The named functional-model generic instance used to state this concrete container's abstraction relation; use its own model operations and types.
API 008
Keys_Model (declaration) — Observe the ordered keys through this declared sequence/array model; it does not by itself supply the associated values.
On normal return the declared contract establishes:
Key_Models.Length (Keys_Model'Result) = Length (Container)
and then (for all I in 1 .. Length (Container) => Key_Models.Get (Keys_Model'Result, I) = Key (Container, I))Ghost: for contracts and ghost code, and left out of the program.
API 009
Element (declaration) — Read an existing logical element; the required index/cursor/presence condition is distinct from the index type's capacity bound.
Before this operation, establish:
Index <= Length (Container)API 010
Find (declaration) — Search for a key/item and return its position/cursor or the declared absent sentinel. The exact contract determines whether first-match/completeness is promised.
On normal return the declared contract establishes:
(if Find'Result = 0 then (for all I in 1 .. Length (Container) => Key (Container, I) /= K)
else Find'Result <= Length (Container) and then Key (Container, Find'Result) = K
and then (for all I in 1 .. Find'Result - 1 => Key (Container, I) /= K))API 011
Contains (declaration) — Test the family's declared membership/search relation; it is not a mutation or a guarantee of constant-time lookup.
API 012
Value (declaration) — Return the value for a present map/dictionary key; establish Contains before lookup.
Before this operation, establish:
Contains (Container, K)API 013
Clear (declaration) — Make the logical container empty. Storage release, cursor validity and inactive-slot contents follow this family's lifecycle rules, not a universal secure-erasure contract.
On normal return the declared contract establishes:
Length (Container) = 0API 014
Insert (declaration) — Add a new element/pair at the family's specified position/order. Absence, room and cursor/index requirements are independent caller obligations.
Before this operation, establish:
not Contains (Container, K) and then Length (Container) < CapacityOn normal return the declared contract establishes:
Length (Container) = Length (Container)'Old + 1
and then Key (Container, Length (Container)) = K
and then Element (Container, Length (Container)) = New_Item
and then (for all I in 1 .. Length (Container'Old) => Key (Container, I) = Key (Container'Old, I) and then Element (Container, I) = Element (Container'Old, I))API 015
Replace (declaration) — Replace an existing map key's value while preserving key order and unrelated pairs.
Before this operation, establish:
Contains (Container, K)On normal return the declared contract establishes:
Length (Container) = Length (Container)'Old
and then (for all I in 1 .. Length (Container) => Key (Container, I) = Key (Container'Old, I))
and then Value (Container, K) = New_Item
and then (for all I in 1 .. Length (Container) => (if Key (Container, I) /= K then Element (Container, I) = Element (Container'Old, I)))API 016
Iter_First (declaration) — Return the first candidate iteration position. Call Has_Element before selecting an element; empty input can still have a candidate.
API 017
Iter_Next (declaration) — Advance the candidate position under the declared sentinel/finite-bound behavior.
API 018
Iter_Has_Element (declaration) — Test whether an iteration candidate denotes a currently present logical element.
API 019
Iter_Key (declaration) — Read the iteration key after establishing Iter_Has_Element; map/dictionary traversal yields keys.
Before this operation, establish:
Iter_Has_Element (Container, Position)