Documentation

LeanPool.BrillNoetherGraphs.Utilities.Subdivision.ClosedRowProof.Tree

The row-proof tree layer, deep-embedded #

Step C of the proof-data source needs a way to lower a SPLIT node. NEXT.md proposed lowering it shallowly, as a generated rcases le_or_gt; this file takes the deep-embedded route instead, for the same reason the corresponding closed-row proof module deep-embeds the arithmetic:

The tree layer is deliberately minimal: SPLIT, LEAF, USE, AUTO, ABSURD, and the one REDUCE opcode whose Lean theorem exists on the closed orthant, REDUCE CUTVERTEX. Spec §4.2's other opcodes (SPLIT3, MOD, CITE, and the other REDUCE operations) are absent on purpose — spec §13.6's rule is that a node shape is a reject until its Lean theorem exists, and adding a constructor here with no soundness case would break PTree.sound rather than silently weaken it.

ABSURD #

(absurd cert) discharges an empty cell: cert is a Farkas derivation of −1 ≥ 0 from the accumulated context, so no point satisfies the context and the row's conclusion holds there vacuously. This is the same Cert and the same Cert.check_sound as everywhere else — the only novelty is that the form entailed is the constant falseForm = −1 rather than something the leaf needs.

It is not a luxury. Splitting a chamber finely produces empty cells as the normal case, so a cover of any size contains them in quantity; a tree layer without ABSURD can only lower covers that were pruned by hand.

AUTO is closed-face sound, not merely an interior-cone shortcut. Its raw permutations are checked against the core, its context forms are pulled back by the slot permutation, and ClosedAuto.bnExists_iff transports through the quotient classes created by zero slots. Named-subtree soundness is therefore kept uniform in the length vector: an auto-wrapped use may invoke the same subtree at the reindexed metric and then transport the result back.

USE, and the shape change it forces #

(use k cert_0 … cert_{m-1}) cites the earlier named subtree k. A subtree carries an entry context — a list of forms it may assume on top of the root domain — and the citing node must show that the context accumulated at the citation entails every one of them. That is pure context weakening, and Cert.check_sound is exactly the entailment half of it.

So use cannot be checked against a tree alone: the checker has to know what the earlier subtrees claim. PTree.checksIn therefore threads a list E of entry contexts, PProof bundles an ordered list of subtrees with a main tree, and subsCheck walks the subtrees in order, each seeing only its predecessors. That ordering is what makes the recursion well-founded and is verbatim rpfcheck.c's "use must reference an earlier subtree".

PTree.checks is kept as the E = [] specialisation, so a proof with no subtrees — every row in the catalog that predates this — lowers to exactly the same term it did before.

The payoff is that a chamber cover whose cells reuse the same local witness stores and checks that witness once: on row 099 the 64 materialized leaves become 15 subtrees plus 64 entailment citations.

REDUCE CUTVERTEX #

(reduce cutvertex v c_0 … c_{p-1}) names an articulation vertex v and two-colours the slots. the proof-data source verifies that the colouring really does split the core at v into two connected positive-genus factors meeting only there, and then cites the factorwise gluing theorem. On the Lean side that citation is RowProof.bnExists_censusSpec_of_genusFourRankOneCheck, the closed-orthant port of Certificate/CoreVertexCutGenusFour.lean's theorem, whose conclusion is verbatim PTree.sound's at degree = 3.

Three things make the fit exact rather than approximate.

The context discipline #

SPLIT g pushes g in the first branch and −1 − g in the second; over the integers those are exhaustive, and that is the entire coverage argument (spec §4.2). New rows are appended at the end of Γ.ge, so a context row's index never changes as the tree descends: at a leaf of a depth-k branch the root's p coordinate rows still sit at indices 0 … p−1 and the branch conditions at p … p+k−1. That stability is what lets the emitter address context rows by a fixed index in every certificate it synthesises.

The constant form −1. A context that entails it is unsatisfiable, which is exactly what an ABSURD node certifies.

Equations
Instances For

    Append a form to the inequality part of a context. Appending, rather than prepending, is what keeps context indices stable down a branch.

    Equations
    Instances For
      theorem Utilities.Subdivision.ClosedRowProof.Context.pushGe_holds {Γ : Context} {g : Form} {x : List ℤ} (hΓ : Γ.Holds x) (hg : 0 ≤ eval g x) :
      (Γ.pushGe g).Holds x

      The REDUCE CUTVERTEX node #

      PTree is core-independent — it is one inductive type, not a family indexed by (n, p, core) — so a cutvertex node cannot carry a CoreVertexCut.Data core directly. It carries raw ℕ data instead, and toCut / toTree decode it against whatever core the checker is run at. Decoding is total: out-of-range indices are reduced % n or % p and missing list entries default to 0, exactly as the generated core itself decodes its tail/head lists. Nothing about the decoded data is believed; genusFourRankOneCheck re-derives every condition the gluing theorem needs.

      Raw data for a (reduce cutvertex …) node: the articulation vertex and one side of the cut, plus a rooted spanning tree witnessing core connectivity.

      The .rpf carries only glue and the slot colouring; left is the colouring converted to a vertex set, and the four tree fields are synthesised by the emitter. Both conversions are validated by the checker rather than trusted.

      • glue : ℕ

        The articulation vertex, as a raw index.

      • left : List ℕ

        The named side of the cut, as raw vertex indices; must contain glue.

      • root : ℕ

        Root of the spanning tree.

      • parent : List ℕ

        parent v, indexed by raw vertex index.

      • parentEdge : List ℕ

        A slot joining v to parent v, indexed by raw vertex index.

      • rank : List ℕ

        A rank that strictly decreases along parent links.

      Instances For

        Decode the articulation vertex and the named side.

        Equations
        Instances For

          Decode the spanning-tree certificate.

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

            The node checker: the three hypotheses of bnExists_censusSpec_of_genusFourRankOneCheck that are not already in scope.

            degree = 3 is demanded because the gluing theorem is degree-three-specific. The empty core (n = 0) and the edgeless core (p = 0) are rejected outright: neither can carry a spanning-tree certificate, and neither is a genus-four row.

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

              Subtrees and their entry contexts #

              A named subtree is checked once, under the root domain extended by its declared entry forms; a use node cites it after re-deriving those forms in whatever context the citation sits in.

              The context a subtree is checked under: the closed root domain, then the subtree's declared entry forms. Appending keeps the root's p coordinate rows at indices 0 … p−1, so a certificate synthesised against the root addresses the same rows inside a subtree.

              Equations
              Instances For

                Positional lookup into the list of entry contexts. Written out rather than taken from List.getElem? so that lookup_mem — the only fact soundness needs — is a three-line induction that cannot drift with the library.

                Equations
                Instances For

                  The citation's obligation: certificate i must entail entry form i. A missing certificate is Cert.dflt, which fails 1 ≤ k, so a use with too few certificates is a reject rather than a gap.

                  Equations
                  Instances For
                    theorem Utilities.Subdivision.ClosedRowProof.entryChecks_sound {Γ : Context} {x : List ℤ} (hΓ : Γ.Holds x) {entry : List Form} {certs : List Cert} :
                    entryChecks Γ entry certs = true → ∀ g ∈ entry, 0 ≤ eval g x

                    A row proof tree: spec §4.2 restricted to the node shapes that have a Lean soundness theorem.

                    • leaf : Witness → PTree

                      A leaf carrying the local witness of spec §4.3.

                    • richLeaf : RichWitness → PTree

                      A full W1--W5 leaf with multiple blocks and positioned chips.

                    • split : Form → PTree → PTree → PTree

                      SPLIT g: the first child is verified under g ≥ 0, the second under −1 − g ≥ 0.

                    • auto : ClosedAuto.AutoData → PTree → PTree

                      AUTO a: verify the child after pulling its context through a checked core automorphism.

                    • cutvertex : CutData → PTree

                      REDUCE CUTVERTEX: a leaf-like node discharged by the genus-four vertex-cut gluing theorem on the closed orthant.

                    • use : ℕ → List Cert → PTree

                      USE k cert…: cite the earlier named subtree k, re-deriving each of its entry forms from the context accumulated here.

                    • absurd : Cert → PTree

                      ABSURD cert: the accumulated context is contradictory — cert derives −1 ≥ 0 from it — so this cell is empty and there is nothing to prove.

                    Instances For

                      The tree checker, in scope of the entry contexts E of the subtrees this node may cite. One Bool for the whole proof.

                      Equations
                      Instances For

                        The tree checker with no subtrees in scope: every use is then a reject. This is the shape every row lowered before use existed still uses.

                        Equations
                        Instances For

                          An ordered list of named subtrees, each with its entry context, and the main tree. Subtree i is checked with E = the entries of subtrees 0 … i−1 only, which is rpfcheck.c's earlier-only rule and what keeps the recursion well-founded.

                          • subs : List (List Form × PTree)

                            (entry, body) per named subtree, in declaration order.

                          • main : PTree

                            The main tree, which may cite every subtree.

                          Instances For

                            Check the subtrees in order, each in scope of its predecessors' entries.

                            Equations
                            Instances For

                              The whole-proof checker: the subtrees, then the main tree in scope of all of them.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                theorem Utilities.Subdivision.ClosedRowProof.CutData.sound {n p : ℕ} (core : Certificate.ExplicitPotential.Core n p) (degree : ℤ) (d : CutData) (hn : 0 < n) (hchk : d.checks core degree = true) (ℓ : Fin p → ℕ) (hForest : Certificate.ContractionForestCensusGeneral.IsForest core (zeroSet ℓ)) (hNotLoopy : ¬Certificate.ContractionForestCensusGeneral.IsLoopy core (zeroSet ℓ)) :
                                BNExists (censusSpec core hn ℓ hForest hNotLoopy).graph 1 degree

                                A checked cutvertex node is sound, by the closed-orthant port of the genus-four vertex-cut gluing theorem. No context is consumed: the conclusion holds on the whole closed orthant, so a fortiori on the node's chamber.

                                theorem Utilities.Subdivision.ClosedRowProof.rootRows_holds {p m : ℕ} (hp : p ≤ m) (point : Fin m → ℤ) (ℓ : Fin p → ℕ) (hlen : ∀ (e : Fin p), ↑(ℓ e) = point (Fin.castLE hp e)) {g : Form} (hg : g ∈ List.map coordForm (List.range p)) :
                                0 ≤ eval g (List.ofFn point)

                                The root domain rows hold at any point whose first p coordinates are the lengths — the half of a subtree's entry context that costs nothing.

                                theorem Utilities.Subdivision.ClosedRowProof.subContext_holds {p m : ℕ} (hp : p ≤ m) (point : Fin m → ℤ) (ℓ : Fin p → ℕ) (hlen : ∀ (e : Fin p), ↑(ℓ e) = point (Fin.castLE hp e)) {entry : List Form} (hentry : ∀ g ∈ entry, 0 ≤ eval g (List.ofFn point)) :
                                (subContext p entry).Holds (List.ofFn point)

                                A subtree's context holds at the point as soon as its declared entry forms do: the root domain rows are free, by rootRows_holds.

                                theorem Utilities.Subdivision.ClosedRowProof.PTree.sound {n p m : ℕ} (core : Certificate.ExplicitPotential.Core n p) (degree : ℤ) (hp : p ≤ m) (hn : 0 < n) (point : Fin m → ℤ) (ℓ : Fin p → ℕ) (hlen : ∀ (e : Fin p), ↑(ℓ e) = point (Fin.castLE hp e)) (hForest : Certificate.ContractionForestCensusGeneral.IsForest core (zeroSet ℓ)) (hNotLoopy : ¬Certificate.ContractionForestCensusGeneral.IsLoopy core (zeroSet ℓ)) (t : PTree) (E : List (List Form)) (Γ : Context) :
                                (∀ entry ∈ E, ∀ (ℓ' : Fin p → ℕ) (hForest' : Certificate.ContractionForestCensusGeneral.IsForest core (zeroSet ℓ')) (hNotLoopy' : ¬Certificate.ContractionForestCensusGeneral.IsLoopy core (zeroSet ℓ')) (point' : Fin m → ℤ), (∀ (e : Fin p), ↑(ℓ' e) = point' (Fin.castLE hp e)) → (subContext p entry).Holds (List.ofFn point') → BNExists (censusSpec core hn ℓ' hForest' hNotLoopy').graph 1 degree) → checksIn m core degree E Γ t = true → Γ.Holds (List.ofFn point) → BNExists (censusSpec core hn ℓ hForest hNotLoopy).graph 1 degree

                                The tree is sound.

                                Every branch of an accepted tree ends in an accepted leaf whose context holds at the point, or in an ABSURD node whose context holds at no point at all. The two SPLIT branches are exhaustive over ℤ, which is the coverage argument of spec §4.2 and the only place it is used.

                                The extra hypothesis hE is the induction's account of USE: every entry context in scope is one whose satisfaction already yields the goal. A use node consumes it by re-deriving that entry context here, which is the context weakening spec §4.2 asks of a citation and nothing more.

                                theorem Utilities.Subdivision.ClosedRowProof.subsCheck_sound {n p m : ℕ} (core : Certificate.ExplicitPotential.Core n p) (degree : ℤ) (hp : p ≤ m) (hn : 0 < n) (subs : List (List Form × PTree)) (acc : List (List Form)) :
                                (∀ entry ∈ acc, ∀ (ℓ : Fin p → ℕ) (hForest : Certificate.ContractionForestCensusGeneral.IsForest core (zeroSet ℓ)) (hNotLoopy : ¬Certificate.ContractionForestCensusGeneral.IsLoopy core (zeroSet ℓ)) (point : Fin m → ℤ), (∀ (e : Fin p), ↑(ℓ e) = point (Fin.castLE hp e)) → (subContext p entry).Holds (List.ofFn point) → BNExists (censusSpec core hn ℓ hForest hNotLoopy).graph 1 degree) → subsCheck m core degree acc subs = true → ∀ entry ∈ acc ++ List.map Prod.fst subs, ∀ (ℓ : Fin p → ℕ) (hForest : Certificate.ContractionForestCensusGeneral.IsForest core (zeroSet ℓ)) (hNotLoopy : ¬Certificate.ContractionForestCensusGeneral.IsLoopy core (zeroSet ℓ)) (point : Fin m → ℤ) (_hlen : ∀ (e : Fin p), ↑(ℓ e) = point (Fin.castLE hp e)), (subContext p entry).Holds (List.ofFn point) → BNExists (censusSpec core hn ℓ hForest hNotLoopy).graph 1 degree

                                The subtree list is sound, processed in order.

                                Each subtree is checked in scope of its predecessors' entry contexts only, so the accumulated soundness fact grows by one entry at a time and never appeals to a subtree that has not yet been proved. This is where rpfcheck.c's "use must reference an earlier subtree" is paid for.

                                theorem Utilities.Subdivision.ClosedRowProof.tree_sound_closed_root {n p : ℕ} (core : Certificate.ExplicitPotential.Core n p) (t : PTree) (degree : ℤ) (hn : 0 < n) (hchk : PTree.checks p core degree (rootContextClosed p) t = true) (ℓ : Fin p → ℕ) (hForest : Certificate.ContractionForestCensusGeneral.IsForest core (zeroSet ℓ)) (hNotLoopy : ¬Certificate.ContractionForestCensusGeneral.IsLoopy core (zeroSet ℓ)) :
                                BNExists (censusSpec core hn ℓ hForest hNotLoopy).graph 1 degree

                                The row obligation for a (domain closed) proof, verbatim.

                                An accepted tree at the closed root proves the goal on every face of the closed length orthant whose vanishing set is a non-loopy forest — that is, on every subdivision of the core and every equal-genus contraction of one. Compare spec §3 and AllMarksCoreCase.SolvedAllMarksClosedCensus.

                                theorem Utilities.Subdivision.ClosedRowProof.proof_sound_closed_root {n p : ℕ} (core : Certificate.ExplicitPotential.Core n p) (P : PProof) (degree : ℤ) (hn : 0 < n) (hchk : PProof.checks p core degree (rootContextClosed p) P = true) (ℓ : Fin p → ℕ) (hForest : Certificate.ContractionForestCensusGeneral.IsForest core (zeroSet ℓ)) (hNotLoopy : ¬Certificate.ContractionForestCensusGeneral.IsLoopy core (zeroSet ℓ)) :
                                BNExists (censusSpec core hn ℓ hForest hNotLoopy).graph 1 degree

                                The row obligation for a (domain closed) proof with named subtrees.

                                Same conclusion as tree_sound_closed_root, for a proof whose cells cite shared subtrees by use. The subtrees are discharged first, in order; the main tree is then checked with all of them in scope.