← Back to Pull requests

νGpd: improve comprehension of coherence statements and proofs #45

Closed
unknown closed this pull request without merging on Sep 19, 2026 02:25 UTC
View on GitHub
unknown unknown commented on Sep 17, 2026 10:33 UTC
Author

Motivation

This PR aims to make the νGpd coherence proofs easier to understand and work with.

PR #23 introduced SSGpd, and PR #30 generalized it to νGpd using an abstract layer former. That generalization made statements such as rew_coh2Layer considerably 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

  • Simplify the layer coherence statements again by moving the layer-map computation paths into the decomposition proofs. The pointwise coherence lemmas can then be stated directly in terms of component paths.

  • Express permutahedral_coherence as 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.

  • Replace the path-induction proof of higher layer coherence with a pasting proof. It composes the six side cells and uses frame coherence to transfer the painting hexagon between the opposite boundaries. The proof now follows the geometry of the coherence.
  • Technical details

    The new νGpd/Pasting.v provides square composition, mapping, and dependent lifts, including a cube lemma for transferring a dependent equality between opposite boundaries. rew_coh2Layer_perm4 applies 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_lmap corrections 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. Both rew_cohLayer_hex and the three square variants construct the missing dependent edge from the other boundary paths. The filler's boundary law gives layer_square, which is then reused in rew_coh2Painting_restr0.

    eq_existT_curried_hex uses sigT_path_paste to 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 lets eq_existT_curried_dep_hex follow 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_cohLayer33 becomes rew_cohLayer_hex, identifying its hexagonal boundary. The square transport-chain lemmas become rew_cohLayer_sq_13, rew_cohLayer_sq_31, and rew_cohLayer_sq_22, recording the three ways to split a square's four edges between its two paths. rew_coh2Layer becomes rew_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 have

  • lmap2_hex_rew_eq ─ used in the coh2-layer coherence proof

  • lmap2_triangle_rew_eq ─ used in the base case of coh2-painting coherence

  • various small lemmas used to build them
  • They 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:

  • specializing to concrete arity ─ simplicial or cubical

  • representing layers as functions of the arity - at the cost of using functional extensionality axiom and making examples non-computable

  • representing layers as functions of the arity in Cubical Type Theory (Agda) - then we can have our cake (making these definitonal) and eat it too (functional extensionality computes)
  • 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 componentwise

  • f_equal_eq_existT_curried ─ f_equal acts on Σ-type paths componentwise

  • eq_trans_eq_existT_curried ─ the composition of Σ-type paths is the same as componentwise compositions

  • a couple other lemmas like that
  • These are used to build:

  • eq_existT_curried_hex ─ decomposition lemma for the recursive case of coh2-frame

  • eq_existT_curried_dep_hex ─ decomposition lemma for the recursive case of coh2-painting
  • The Σ-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 ─ the coh2-painting base case lemma

  • rew_coh2Layer_perm4 ─ the coh2-layer decomposition lemma, the most interesting one. Here we assume coh3-frame and coh2-painting, and use them to build coh2-layer, this is where permetahedron appears
  • We prove these using the lemmas from the pasting kit:

  • square_compose ─ compose two squares horizontally

  • square_stack ─ compose two squares vertically

  • square_map ─ apply a function to every edge of a square

  • square_compose_dep, square_stack_dep, square_map_dep ─ lift these operations to dependent squares

  • square_compose_map ─ compose squares whose lower edges are mapped paths

  • layer_square_map ─ map a layer-coherence square and adjust its endpoints using naturality

  • layer_square_nat ─ extend a layer-coherence square along a source path using naturality

  • square_compose_map_dep, layer_square_map_dep, layer_square_nat_dep ─ dependent lifts of these three constructions

  • square_cube_map_dep ─ given a coherent base cube and dependent lifts of five faces, construct the sixth dependent face
  • The 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_dep and eq_existT_curried_eq are trivial ─ just a pair constructor

  • f_equal_eq_existT_curried ─ definitional equality, hols by refl

  • eq_trans_eq_existT_curried ─ is _not_ a definitional equality
  • The reason of why the latter is not definitional comes down to how the hcomp rule for Σ-types is generated by Agda, how comp is defiend through hcomp and transp, and how certain transp terms do not compute (as Cubical Agda doesn't have regularity). It turns out, the "how the hcomp rule 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 use hcomp directly instead of comp for 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_curried lemma also hold definitionally. For Bonak, this implies that the whole coh2-frame decomposition lemma (which requires the three lemmas above) becomes trivial, the coh2-frame coherence can then be defined to be just a pair, similarly to level-1 coh-frame and coh-painting coherences.

    The patch, however, addresses only a non-dependent case ─ the dependent case is needed for coh2-painting decomposition, and that one still doesn't become trivial. For that one, HOTT/Narya still provides an advantage over Cubical Type Theory/Agda.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: olympichek Review duration: 2392m
    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
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository