Computing a graph degree from a represented adjacency row #
The executable function is Ram.Source.Array.sumFunctions.function.sum: the
same fixed array loop used for ordinary word sums. Its specification here uses
mathlib's SimpleGraph and SimpleGraph.degree, without opening that loop's
register, call-frame or memory-preservation proofs.
The adjacency row must already be present in memory. adjacencyRow describes
that representation; it is not an executable graph loader or a free call to a
Lean adjacency predicate. The function receives only a pointer and a length.
The address bound ensures both safe traversal and an exact, non-wrapping degree.
Correctness uses no proposed step budget. The separate time theorem bounds the
same function body; an enclosing call additionally pays its generated overhead.
The mathematical view of one preloaded adjacency row, with one word per
vertex. This definition specifies memory contents; the RAM function does not
evaluate G.Adj.
Equations
Instances For
Reinterpret the list sum using mathlib's finite-neighbor-set definition of degree. No implementation-specific invariant is needed in this step.
The returned word decodes to the exact mathematical degree when the row length fits; the graph-theoretic bound comes directly from mathlib.
A graph-valued mathematical specification of the reusable sum function. Only its parameter list, represented input row and returned value are visible; the entire caller state is preserved.
Compute a graph degree without a main, an input stream or an output
instruction. This is an invocation of the actual fixed array-sum function.
The unchanged implementation has a linear body-step bound in the number of vertices. Constructing the represented row and invoking the function from another function are not included in this body count.
Correctness and cost hold of one invocation, rather than unrelated mathematical result and time functions.
The ordinary executable sum returns a graph degree on a represented adjacency row. The proof uses its value equation and mathlib's graph facts; it does not reopen an execution relation, loop or calling convention.