Documentation

LeanPool.IsoGraph.Canon.Correct

The search meets its specification #

The two halves of the correctness proof meet here.

Instantiating the second at the root gives canonSt_dom, and together they give canonSt_bestKey — the search's answer satisfies BestKey, the specification stated back in IsoGraph/Canon/Search.lean. Since BestKey is manifestly an isomorphism invariant (bestKey_transfer) and determines its key uniquely (bestKey_unique), the certificate the search returns does not depend on how the vertices were named: canonical_cert_relabel.

That is exactly what Spec.LabellingInvariant needs, once certOf_get is used to read the adjacency matrix back out of the packed certificate (canonical_get).

theorem IsoGraph.Canon.ancReach_root (n : ) (f : Bool) (k : List (List UInt64)) :
ancReach n f #[] 0 k Leafkey n f k
theorem IsoGraph.Canon.canonSt_dom (n : ) (f : Bool) (k : List (List UInt64)) (hk : Leafkey n f k) :
Dom (canonSt n f) k

The search finds the best leaf. Instantiating dfsNode_dom at the root: the state the search ends in dominates every leaf of the whole tree.

theorem IsoGraph.Canon.canonSt_bestKey (n : ) (f : Bool) (b : Leaf) (hb : (canonSt n f).best = some b) :

The search meets its specification. The key of the leaf it settles on is the largest key of any leaf of the (unpruned) tree.

theorem IsoGraph.Canon.canonical_get (n : ) (f : Bool) {i j : } (hi : i < n) (hj : j < n) :

Reading the winner's certificate back gives the adjacency in the canonical order.

theorem IsoGraph.Canon.canonical_cert_relabel (n : ) (f : Bool) {s : } (hs : IsPerm n s) :
(canonical (Graph.ofOracle n fun (v w : ) => f (s v) (s w))).cert = (canonical (Graph.ofOracle n f)).cert

The winner's certificate is an isomorphism invariant. The search on the renamed graph settles on a leaf with the same certificate as the search on the original.