νGpd: improve comprehension of coherence statements and proofs #45
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #45"
general
weight: 0.35
olympichek
Motivation
This PR aims to make the
νGpdcoherence proofs easier to understand and work with.PR #23 introduced
SSGpd, and PR #30 generalized it toνGpdusing an abstract layer former. That generalization made statements such asrew_coh2Layerconsiderably more complicated by exposing layer-map computation paths. This complexity turned out to be unnecessary: the decomposition lemmas can handle those paths internally.The higher coherence proofs also relied on long sequences of path induction (
destruct/J). These prove the required equalities, but reveal little of their underlying structure and are difficult to build on if we consider an extension to ν-2-groupoids. The aim is to make that structure visible in both the statements and the proofs.Overview
permutahedral_coherenceas a symmetric 4=4 equality of hexagon pastings, replacing the previous 1=7 formulation. Including the naturality squares, each side contains seven faces. Making all six squares explicit gives a cleaner statement whose permutahedral shape is easier to recognize.Technical details
The new
νGpd/Pasting.vprovides square composition, mapping, and dependent lifts, including a cube lemma for transferring a dependent equality between opposite boundaries.rew_coh2Layer_perm4applies these operations to the two boundary pastings. Three naturality squares come from the restriction coherences and three from the comparison maps; each combines with one hexagon to form a side cell.The layer decomposition lemmas accept component homotopies at arbitrary inputs. Endpoint-change laws cancel the
nth_lmapcorrections at shared vertices, leaving only the exterior corrections. The layer path proofs also use dependent-map laws and transport naturality.The transport-chain proofs use a common dependent square filler,
sigT_square_fill. Bothrew_cohLayer_hexand the three square variants construct the missing dependent edge from the other boundary paths. The filler's boundary law giveslayer_square, which is then reused inrew_coh2Painting_restr0.eq_existT_curried_hexusessigT_path_pasteto assemble edge comparisons into normalizations of both boundary paths. It then compares their components and reverses the right normalization. A transport law for this pasting operation letseq_existT_curried_dep_hexfollow the same decomposition at the next dependent level. These operations expose the structure of the transparent proof terms for use in higher coherence proofs.The coherence lemmas are renamed to reflect their shapes.
rew_cohLayer33becomesrew_cohLayer_hex, identifying its hexagonal boundary. The square transport-chain lemmas becomerew_cohLayer_sq_13,rew_cohLayer_sq_31, andrew_cohLayer_sq_22, recording the three ways to split a square's four edges between its two paths.rew_coh2Layerbecomesrew_coh2Layer_perm4, reflecting its use of the symmetric 4=4 permutahedral coherence.***
Architecture of the ν-groupoid construction
There are three kinds of decomposition lemmas we use in the ν-groupoid construction.
The first one: "layer correction" lemmas
These live in
νGpd/Layer.v. In this category we havelmap2_hex_rew_eq─ used in thecoh2-layercoherence prooflmap2_triangle_rew_eq─ used in the base case ofcoh2-paintingcoherenceThey exist as a consequence of layer laws (i.e.
nth_lam) not being definitional in the abstract layer signature. We can, in principle, make them definitional by doing one of the following:The second one: "algebra of paths of Σ-types" lemmas
In this category we have:
eq_existT_curried_eq─ paths in the Σ-type are equal when they are equal componentwisef_equal_eq_existT_curried─f_equalacts on Σ-type paths componentwiseeq_trans_eq_existT_curried─ the composition of Σ-type paths is the same as componentwise compositionsThese are used to build:
eq_existT_curried_hex─ decomposition lemma for the recursive case ofcoh2-frameeq_existT_curried_dep_hex─ decomposition lemma for the recursive case ofcoh2-paintingThe Σ-type path algebra lemmas live in
Lemmas/SigT.v, while the decomposition lemmas live inνGpd/Lemmas.v.Most (but not all, there are some subtleties, as described in the subsection below) of these are trivial in Cubical Type Theory (Agda). All of them are trivial in Higher Observational Type theory (Narya).
The third one: "essential mathematical structure" of the coherences
Here we have these:
rew_coh2Painting_restr0─ thecoh2-paintingbase case lemmarew_coh2Layer_perm4─ thecoh2-layerdecomposition lemma, the most interesting one. Here we assumecoh3-frameandcoh2-painting, and use them to buildcoh2-layer, this is where permetahedron appearsWe prove these using the lemmas from the pasting kit:
square_compose─ compose two squares horizontallysquare_stack─ compose two squares verticallysquare_map─ apply a function to every edge of a squaresquare_compose_dep,square_stack_dep,square_map_dep─ lift these operations to dependent squaressquare_compose_map─ compose squares whose lower edges are mapped pathslayer_square_map─ map a layer-coherence square and adjust its endpoints using naturalitylayer_square_nat─ extend a layer-coherence square along a source path using naturalitysquare_compose_map_dep,layer_square_map_dep,layer_square_nat_dep─ dependent lifts of these three constructionssquare_cube_map_dep─ given a coherent base cube and dependent lifts of five faces, construct the sixth dependent faceThe pasting kit lemmas live in
νGpd/Pasting.v, the decomposition lemmas live inνGpd/Lemmas.v.The status quo in Cubical Agda
eq_existT_curried,eq_existT_curried_depandeq_existT_curried_eqare trivial ─ just a pair constructorf_equal_eq_existT_curried─ definitional equality, hols byrefleq_trans_eq_existT_curried─ is _not_ a definitional equalityThe reason of why the latter is not definitional comes down to how the
hcomprule for Σ-types is generated by Agda, howcompis defiend throughhcompandtransp, and how certaintranspterms do not compute (as Cubical Agda doesn't have regularity). It turns out, the "how thehcomprule for Σ-types is generated by Agda" part can actually be improved, by implementing an optimization for the non-dependent record fields (such as the first projection of a Σ-type) ─ to usehcompdirectly instead ofcompfor these fields. See the Agda issue #8754 for the discussion of this problem, and Agda PR #8755 for a proposed patch.With the patch, the
eq_trans_eq_existT_curriedlemma also hold definitionally. For Bonak, this implies that the wholecoh2-framedecomposition lemma (which requires the three lemmas above) becomes trivial, thecoh2-framecoherence can then be defined to be just a pair, similarly to level-1coh-frameandcoh-paintingcoherences.The patch, however, addresses only a non-dependent case ─ the dependent case is needed for
coh2-paintingdecomposition, and that one still doesn't become trivial. For that one, HOTT/Narya still provides an advantage over Cubical Type Theory/Agda.