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 whole tree becomes one piece of data and one
decide, instead of onedecideper leaf plus a generated tactic script whose size is the number of nodes — forg4row099that is 64 leaves and 63 splits; - the accumulated context at a leaf is computed by
PTree.checksrather than transcribed by the emitter, so the emitter cannot get it wrong; - the
rcases le_or_gtof the shallow plan survives verbatim, once, insidePTree.soundbelow, where it is proved rather than generated.
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 Lean checker is
CoreVertexCut.Data.genusFourRankOneCheck, which re-derives the cut, the two factor genera, and — on a genus-one factor — the two-regularity thatPointedGenusOneRigidneeds. The colouring is not trusted:CutDatacarries rawℕs,toCutdecodes them totally, and the checker validates the decoding. A.rpfcolouring that does not in fact cut the core is simply rejected bydecide. - The gluing theorem is specific to
degree = 3, unlike the rest ofPTree.sound, which is generic indegree.CutData.checkstherefore demandsdegree = 3outright rather than papering over the difference. - The node's conclusion is unconditional — it holds on the whole closed
orthant — so
CutData.checksignores the accumulated contextΓ. That is sound in the safe direction: the node proves more than its chamber needs.
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.
−1 − g: the negation of g ≥ 0 over the integers.
Equations
Instances For
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.
Instances For
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.
The named side of the cut, as raw vertex indices; must contain
glue.- root : ℕ
Root of the spanning tree.
parent v, indexed by raw vertex index.A slot joining
vtoparent v, indexed by raw vertex index.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
- Utilities.Subdivision.ClosedRowProof.subContext p entry = { ge := List.map Utilities.Subdivision.ClosedRowProof.coordForm (List.range p) ++ entry, eq := [] }
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
- One or more equations did not get rendered due to their size.
- Utilities.Subdivision.ClosedRowProof.entryChecks Γ [] x✝ = true
Instances For
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 underg ≥ 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 subtreek, re-deriving each of its entry forms from the context accumulated here. - absurd : Cert → PTree
ABSURD cert: the accumulated context is contradictory —certderives−1 ≥ 0from 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
- One or more equations did not get rendered due to their size.
- Utilities.Subdivision.ClosedRowProof.PTree.checksIn m core degree E Γ (Utilities.Subdivision.ClosedRowProof.PTree.leaf w) = w.leafChecks m core Γ degree
- Utilities.Subdivision.ClosedRowProof.PTree.checksIn m core degree E Γ (Utilities.Subdivision.ClosedRowProof.PTree.richLeaf w) = w.richLeafChecks m core Γ degree
- Utilities.Subdivision.ClosedRowProof.PTree.checksIn m core degree E Γ (Utilities.Subdivision.ClosedRowProof.PTree.cutvertex d) = d.checks core degree
- Utilities.Subdivision.ClosedRowProof.PTree.checksIn m core degree E Γ (Utilities.Subdivision.ClosedRowProof.PTree.absurd w) = w.check Γ Utilities.Subdivision.ClosedRowProof.falseForm
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
- Utilities.Subdivision.ClosedRowProof.PTree.checks m core degree Γ t = Utilities.Subdivision.ClosedRowProof.PTree.checksIn m core degree [] Γ t
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.
(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
- One or more equations did not get rendered due to their size.
- Utilities.Subdivision.ClosedRowProof.subsCheck m core degree x✝ [] = true
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
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.
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.
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.
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.
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.
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.
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.