Documentation

HexGraphIso.Nauty.Sparse.MaxFirstLeaf

Actual first preparation extends the stored ancestor codes by its executed refinement code at the allocated next slot.

theorem Hex.GraphIso.Nauty.Sparse.Max.Frame.Valid.first_key {n k : Nat} {G : Sparse.Colored n k} {tcLevel : Nat} {f : Frame n} {label : Label n} (h : Valid G f) :
have p := Generic.prepareFirst (Graph.ofGraph G.graph) tcLevel f.level f.numcells f.entry; p.fst = n → Label.ofArray? n p.snd.snd.snd.snd.lab = some label → key G.graph tcLevel f = { codes := f.codes ++ [code G.graph f] ++ [codeSentinel], graph := G.graph.relabel label.perm }

The label at an actual first discrete visit has exactly the complete frozen node key, with the native ancestor codes and sentinel.

theorem Hex.GraphIso.Nauty.Sparse.Max.Frame.Valid.first_best {n k : Nat} {G : Sparse.Colored n k} {tcLevel : Nat} {f : Frame n} (h : Valid G f) (hs : StoredCodes f.entry.firstcode 1 f.codes) (ha : n < f.entry.firstcode.size) (hc : f.entry.canoncode.size = n + 2) (hb : ∀ (code : Nat), code ∈ f.codes → code < codeSentinel) :

The first leaf's installed native incumbent is the whole frozen node key. Its code machine is derived from the actual stored prefix and allocation, without an assumed leaf comparison or key equality.

The actual first discrete node installs its prepared leaf and invokes no sibling continuation.

theorem Hex.GraphIso.Nauty.Sparse.Max.Frame.Valid.first_leaf {n k : Nat} {G : Sparse.Colored n k} {tcLevel fuel : Nat} {f : Frame n} (h : Valid G f) (hs : StoredCodes f.entry.firstcode 1 f.codes) (ha : n < f.entry.firstcode.size) (hc : f.entry.canoncode.size = n + 2) (hb : ∀ (code : Nat), code ∈ f.codes → code < codeSentinel) (hd : (Generic.prepareFirst (Graph.ofGraph G.graph) tcLevel f.level f.numcells f.entry).fst = n) (witness : Nat → Option (Key n) → Prop) :
have out := Generic.node true (Graph.ofGraph G.graph) (n + 2) tcLevel (fuel + 1) f.level f.numcells f.entry; MaxResult (key G.graph tcLevel f) none (State.best G.graph out.snd) (f.level - 1) witness out.fst

The executed first discrete call satisfies its full maximum contract from actual code storage and allocation, including a root-level return.