feat: Turing degrees form an upper semilattice #34899
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 279 lines diff across 3 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.337
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #34899"
general
weight: 0.35
tannerduve
This PR equips
TuringDegreewith aSemilatticeSupstructure by introducing the Turing join, proving usual least-upper-bound properties, and lifting these to degrees (quotients). In support of this, it extends the existingRecursiveInAPI with some lemmas used in the degree theory.We split the existing
TuringDegree.leanfile intoRecursiveIn.leanwhich contains the general API for oracle computability, andTuringDegree.leannow just contains the degree theory.The main contribution is the
SemilatticeSupinstance onTuringDegree. We define the Turing join as followsand prove it is a least upper bound:
left_le_join,right_le_joinjoin_lejoin_mono,join_congr)We lift this to degrees in
TuringDegree.sup,TuringDegree.le_sup_left,TuringDegree.le_sup_right, andTuringDegree.sup_leNew additions to
RecursiveIn.lean:liftPrim,liftPrimrec,RecursiveIn',ComputableIn,ComputableIn₂: Encodes partial/total functions betweenPrimcodabletypes asℕ →. ℕ, analogous toPartrec/Computable.of_eq,of_eq_tot,of_primrec,some,none,mono,subst: Standard closure properties forRecursiveIn.cond_const,cond_core_rfind,cond,ComputableIn.cond: ShowsRecursiveInis closed under conditionals when the guard is absolutely computableNat.Partrec.recursiveIn,Computable.computableIn: Every partrec/computable function is recursive in any oracle set.Small addition to
Partrecwe add to
Mathlib.Computability.Partreca small helper def (Partrec.eq01and relatedrfindlemmas) representing the function that returns 0 if its two (unpaired) arguments are equal, 1 otherwise, which is used in the proof ofcondTODO
Some current
RecursiveInproofs such ascond_core_rfindstill work directly with the inductive constructors and are thus very long. A follow up could add a combinator-style closure library byessentially relativizing all the results and lemmas inPartrec, and proofs could be golfed heavily as they are inPartrec