Counting and extending non-backtracking walks #
This module provides the counting vocabulary for the Alon–Hoory–Linial bound.
It builds on IsNonBacktracking, counts walks by their start and end vertices,
and describes the one-edge extension operation used in the weighted argument.
Contents #
nb_concat_iff— the extension characterization: a non-nil walkpextended by an edge totstays non-backtracking iffpwas andtdiffers fromp's penultimate vertex. This is the per-step branching rule the count is built on.nbWalksFrom— the finset of length-knon-backtracking walks starting atx, bundled with their (varying) endpoints as a sigma type;card_nbWalksFromidentifies its cardinality with the sum over endpoints of the filteredfinsetWalkLength.
Formalization note #
The bundled count is ∑ v, ((G.finsetWalkLength r x v).filter IsNonBacktracking).card, which equals
the cardinality of the sigma-biUnion nbWalksFrom G x r (the endpoints vary, so a bare biUnion
over fun v => Finset (G.Walk x v) is not type-correct — the fibers must be tagged by their
endpoint first, which is exactly what nbWalksFrom does).
IsNonBacktracking is decidable: the defining ∀ i, i + 2 ≤ length → … is a bounded quantifier
(any witness has i < length), so it reduces to a Nat.decidableBallLT-style decision.
Extension characterization. A non-nil walk p : G.Walk x y followed by an edge h : Adj y t
is non-backtracking iff p is and the new vertex t differs from p's penultimate vertex (so the
last step does not reverse the previous one).
The embedding tagging a walk p : G.Walk x v with its endpoint v.
Instances For
The finset of length-k non-backtracking walks starting at x, bundled with their endpoints.
Equations
- ACMax.nbWalksFrom G x k = Finset.univ.biUnion fun (v : V) => Finset.map (ACMax.sigmaWalkEmb G x v) (Finset.filter ACMax.IsNonBacktracking (G.finsetWalkLength k x v))
Instances For
Membership in nbWalksFrom: a bundled walk lies in it iff it has the right length and is
non-backtracking.
The bundled count equals the sum over endpoints of the filtered finsetWalkLength
cardinality.
The one-edge non-backtracking extensions of a bundled walk s = ⟨u, p⟩: for each neighbour t
of u other than the penultimate vertex of p, the walk p.concat _.
Equations
- ACMax.nbExtend G x s = Finset.image (fun (t : V) => if h : G.Adj s.fst t then ⟨t, s.snd.concat h⟩ else ⟨x, SimpleGraph.Walk.nil⟩) (G.neighborFinset s.fst \ {s.snd.penultimate})