--  F4: a cell holds only copyable values, not an owning pointer
with Boxes;
package Lists
  with Annotate => (Verada, Enclave)
is
   type List is limited private;
   function Model (L : List) return Natural with Ghost;
   function Length (L : List) return Natural
     with Post => Length'Result = Model (L);
private
   type Node;
   type Node_Ptr is access Node;
   type Node is record
      Value : Integer;
      Next : Node_Ptr;
      Data : Boxes.Box;
   end record;
   type List is limited record
      Head : Node_Ptr;
      Count : Natural := 0;
   end record
     with Type_Invariant => List.Count < Natural'Last;
   function Model (L : List) return Natural is (L.Count);
   function Length (L : List) return Natural is (L.Count);
end Lists;
