Adjacency-list queries as a state-transition specification #
AdjacencyList.spec n is a read-only interface to a weighted directed graph on Fin n, given by
its adjacency lists of (target, weight) pairs. A client asks for the out-degree of a vertex
(degree) and for the i-th edge out of it (edge). The graph itself stays behind the
interface: a client sees one vertex and one weight per query, never a whole list. The state is
never changed. An edge query is admissible only below the out-degree.
An implementation stores the graph as it likes, for example as the offset and edge arrays that a
word RAM reads from its input. Its correctness and its charges are then proved against step.
Main definitions #
AdjacencyList.State,AdjacencyList.Op,AdjacencyList.step,AdjacencyList.valid: the adjacency lists, the two queries with their answers, the transition function and the admissibility precondition.AdjacencyList.spec: the deterministic specification overFin n.
Main results #
AdjacencyList.step_degree,AdjacencyList.step_edge: the answers of the two queries.
The adjacency lists of a weighted directed graph on Fin n: adj u holds a pair (v, c)
for each edge from u to v of weight c.
The answer types of the queries.
The adjacency-list interface of graphs on Fin n.