Redefine `mkRestrPainting` to have better computation rule for `q := 0` case #12
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 545 lines diff across 6 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.377
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #12"
general
weight: 0.35
olympichek
The problem
Here is the current definition of
mkRestrPainting:In the recursive case of this definition, both direction variable
qandextraDepsCohsare decreasing, so Rocq is free to choose either of them as a structurally smaller value that makes the recursion well-founded. In practice, for this definition, Rocq choosesextraDepsCohs. However, at theq := 0case the definition ofmkRestrPaintingactually doesn't depend onextraDepsCohs. Thus, we might expectmkRestrPaintingto evaluate atq := 0irregardless ofextraDepsCohs, but with the current definition this is not the case:This makes the proofs of coherence equations for paintings more complicated than they should be, i.e. makes it necessary to rely on dependent pattern matching, which doesn't always behave in obvious way:
Possible solutions
Implement
mkRestrPaintingin such a way to regain this definitional equality atq := 0. The issue here is that we can't directly instruct Rocq to considerqthe structurally smaller value for the recursion, asqis hidden beyondmkRestrPaintingTypedefinition. We can consider inliningmkRestrPaintingTypeand making recursion overqexplicit:Note that this term-level definition with explicit recursion over
qturns to be cleaner and less verbose than the one proposed in pull request #9. This is the one implemented in this pull request.Alternatively, we can continue using tactics, but explicitly use
induction q:With both of the definitions above we get
mkRestrPainting extraDepsCohs 0 leR_O ε d (l; c) = (l ε)provable byreflexivitywithout the need to destructextraDepsCohs, which allows to avoidrefine (match ...)trick in coherence equations for paintings. This is especially beneficial in a more complicated coherence proofs that I am working on, for degeneracies in all directions.