--  Verada predefined library: footprints, the cells a proof enclave's
--  object owns, as a set of the enclave's access values. An enclave type's full view holds
--  its footprint in a component of type Cells, which its operations keep up to date and its
--  contracts state; the heap engine proves that each operation reads and writes only cells in
--  its objects' footprints, so that what it does to one object leaves every other unchanged.
--
--  The prover sees a set as an array from locations to Booleans and these functions as its
--  operations; `for all P of S => ...` states something of every cell of S (closure, say:
--  every pointer a footprint's cells hold is null or in the footprint). In the program a set
--  takes no storage: the functions are for contracts, assertions and the assignments that
--  keep footprints, not for the program's decisions.
generic
   type Location is private;
package Verada.Footprints
  with Pure
is
   type Cells is private
     with Iterable => (First => First, Next => Next, Has_Element => Contains, Element => Element);

   --  no cell
   function Empty return Cells;

   function Contains (S : Cells; P : Location) return Boolean;

   --  S with P
   function Add (S : Cells; P : Location) return Cells;

   --  S without P
   function Remove (S : Cells; P : Location) return Cells;

   --  the cells of Left or Right
   function Union (Left, Right : Cells) return Cells;

   --  every cell of Left is in Right
   function "<=" (Left, Right : Cells) return Boolean;

   --  no cell is in both
   function Disjoint (Left, Right : Cells) return Boolean;

   --  iteration over the cells (by the cells themselves)
   function First (S : Cells) return Location;
   function Next (S : Cells; P : Location) return Location;
   function Element (S : Cells; P : Location) return Location;
private
   type Cells is null record;
end Verada.Footprints;
