Documentation

HexGraphIso.Tactic

The non-dependent runtime image of a coloured graph, so elaboration-time meta code can evaluate closed Colored n k terms without knowing n and k at compile time.

  • n : Nat

    The number of vertices.

  • k : Nat

    The number of colours.

  • rows : Array (Nauty.VSet self.n)

    The packed adjacency rows.

  • colors : Array Nat

    The colour of each vertex.

Instances For
    @[instance_reducible]
    Equations
    def Hex.GraphIso.Colored.toRaw {n k : Nat} (G : Colored n k) :

    The runtime image of a coloured graph.

    Equations
    Instances For

      The logical limits of one graph_iso call.

      • maxSearchNodes : Nat

        Nodes the compiled search may visit per graph, both for the witness search and for the certificate producer.

      • maxCertRecords : Nat

        Certificate records per graph the kernel replays. Exceeding it abandons the certificate route, not the tactic.

      • maxKernelSteps : Nat

        Estimated kernel work: checkCost n for a witness, and (records + autom + 2) * checkCost n for a certificate pair. This is the limit that bounds the work the kernel itself does, so it is the one to raise for a goal the elaborator solves but the kernel cannot finish.

      Instances For

        Elaborate the (field := value) limits of one graph_iso call.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Evaluate a closed Colored n k expression to its runtime image.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Run the nauty-compatible canonical search on a runtime graph.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Check a raw transporter: colour preservation and adjacency transport.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                The untrusted elaboration-time search: compare canonical forms and compose the two canonical labels into a forward transporter. Returns the transporter, or none for non-isomorphic inputs, together with the total node count.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Build the literal Perm n expression (Perm.ofNatArray? n #[...]).getD (Perm.id n).

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Build of_decide_eq_true (Eq.refl true) : p without reducing decide p in the elaborator: the kernel performs the one decisive evaluation when it checks the ascribed Eq.refl. mkDecideProof evaluates twice, once at elaboration and once at kernel checking, which doubles the cost of every replay.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      The flat Bool literal of a raw graph's adjacency matrix, in row-major order.

                      Equations
                      Instances For

                        A List Bool literal expression.

                        Equations
                        Instances For

                          The expression e.graph.adjMatrix.data.toList for a coloured graph expression e: the left-hand side of the flat-literal equality.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            The expression Kernel.packRows n e.graph.adjMatrix.data.toList: the left-hand side of the packed-rows equality the negative routes replay.

                            Equations
                            Instances For

                              The packed rows of a runtime graph, row v at bits [n * v, n * (v + 1)): the right-hand side of the packed-rows equality.

                              Equations
                              Instances For

                                One side of a negative goal: the graph expression, its runtime image, the packed-rows literal, and the proof that the graph's adjacency packs to that literal. Both negative routes replay against these, so each side is evaluated once per call.

                                • expr : Lean.Expr

                                  The coloured graph expression.

                                • raw : Raw

                                  Its runtime image.

                                • tie : Lean.Expr

                                  The proof of Kernel.packRows n expr.graph.adjMatrix.data.toList = lit.

                                • lit : Lean.Expr

                                  The packed-rows literal.

                                Instances For

                                  Evaluate a coloured graph expression and prove its packed rows equal to a literal, in one kernel evaluation of the graph's adjacency.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    Reify a certificate tree as a literal expression.

                                    Reify a literal canonical key as an expression.

                                    Equations
                                    Instances For

                                      Match Isomorphic G H (returning (false, n, k, G, H)) or ¬ Isomorphic G H (returning true first). Other goals give none.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

                                        Match the uncoloured Graph.Isomorphic G H (returning (false, n, G, H)) or its negation (returning true first). Other goals give none.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          The root-separator leg of the negative path. When the two root refinement codes already differ (the typical case for irregular pairs) the kernel evaluates one refinement per graph, so this leg is tried first on every negative goal.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            The certificate leg of the negative path. Compiled code produces one budgeted certificate per side and compares the two canonical keys. The kernel then replays two Boolean Kernel.checkKey calls and one checkDiffL call. When a limit runs out the result names that limit. When the two keys agree this throws, because the goal is then not provable.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For

                                              Produce a proof of ¬ Isomorphic G H for closed executable coloured graphs: the root separator first, then certificate replay. The certificates replay only because every declaration they reach is exposed across module boundaries, which HexGraphIso.ModuleBoundaryTests checks. Both the Colored negative branch and downstream extensions use this: HexGraphIsoMathlib calls it on the encoded graphs.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                def Hex.GraphIso.Tactic.proveIsIso (cfg : Config) (n : Nat) (GE HE : Lean.Expr) (a b : Raw) (p : Array Nat) (nodes : Nat) :

                                                The witness leg of the positive path: prove each side's adjacency, its colouring and the transporter equal to literals, then check the transporter on those literals. Returns the permutation expression and the proof of IsIso G H p. The Colored branch wraps that proof as Isomorphic, and downstream extensions decode it.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  A graph_iso goal handler contributed by a downstream library. A public meta def of this type tagged @[graph_iso_extension] extends the same graph_iso syntax to that library's goal shapes.

                                                  Instances For

                                                    The registered graph_iso extensions, in declaration order.

                                                    All extensions present in the current environment, in lookup order.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For

                                                      Prove a graph_iso goal over executable coloured graphs.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For

                                                        Prove a graph_iso goal over executable uncoloured graphs: colour every vertex alike, hand the pair to proveGraphIso, and transport the conclusion back through Graph.isomorphic_singleColor_iff. Both directions of that equivalence are proof terms, so the uncoloured route costs the kernel nothing beyond the coloured goal's replay and the one 0 < n decision.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For

                                                          Close a closed Isomorphic or ¬ Isomorphic goal over executable graphs, coloured (Colored n k) or uncoloured (Graph n).

                                                          Three logical limits are optional and may appear in any order:

                                                          graph_iso (maxSearchNodes := 200000) (maxCertRecords := 200000)
                                                            (maxKernelSteps := 10000000)
                                                          

                                                          They default to 100000, 100000, and 5000000. Importing HexGraphIsoMathlib extends this same tactic to Mathlib SimpleGraph goals. See the module docstring for the proof routes.

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For

                                                            Elaborator for graph_iso: parse the optional limits, then dispatch to proveGraphIso on the core Colored goal shapes, proveGraphIsoUncolored on the Graph shapes, and then each registered Extension in turn.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For