On this page
Verada.Containers.Hash_Sets
A hash set of integers, proved, on the proof-enclave hash map (Verada.Containers.Hash_Maps): its members are the map's keys. Clients treat a set as its model, its members in the order they were first included.
Read the family guide for how the unbounded containers are used and proved. The complete declaration page retains exact signatures/contracts; the source specification is the implementation baseline.
Availability and ownership
Its operations are the hash map's, and the map underneath is proved whole. A set is limited, and Clear frees its table.
Import and instantiate
with Verada.Containers.Hash_Sets;import Verada.Containers.Hash_Sets;
API 001
Maps (declaration) — The hash map instance the set is made of.
Declared interface:
package Maps is new Verada.Containers.Hash_Maps (Boolean);API 002
Member_Sequences (declaration) — The sequences of members a model is.
Declared interface:
package Member_Sequences renames Maps.Key_Sequences;API 003
Has (declaration) — Whether a model has a member.
Declared interface:
function Has (M : Member_Sequences.Sequence; K : Integer) return Boolean is
(for some I in 1 .. Member_Sequences.Length (M) => Member_Sequences.Get (M, I) = K)
with Ghost;API 004
Included (declaration) — A model with a member: a new one last.
Declared interface:
function Included (M : Member_Sequences.Sequence; K : Integer) return Member_Sequences.Sequence is
(if Has (M, K) then M else Member_Sequences.Add (M, K))
with Ghost, Pre => Member_Sequences.Length (M) < Verada.Storage.Length_Bound;API 005
Set (declaration) — The set; empty when declared.
Declared interface:
type Set is limited private
with Default_Initial_Condition => Member_Sequences.Length (Model (Set)) = 0;API 006
Model (declaration) — The members, each once, in the order they were first included.
Declared interface:
function Model (S : Set) return Member_Sequences.Sequence
with Ghost;API 007
Length (declaration) — How many members.
Declared interface:
function Length (S : Set) return Natural
with Post => Length'Result = Member_Sequences.Length (Model (S));API 008
Contains (declaration) — Whether an integer is a member.
Declared interface:
function Contains (S : Set; K : Integer) return Boolean
with Post => Contains'Result = Has (Model (S), K);API 009
Include (declaration) — Makes an integer a member.
Declared interface:
procedure Include (S : in out Set; K : Integer)
with Post => Model (S) = Included (Model (S)'Old, K);API 010
Clear (declaration) — Removes every member and frees the table.
Declared interface:
procedure Clear (S : in out Set)
with Post => Length (S) = 0;