Repository navigation
Import Formal MathFin v2 market pricing and risk library - #1069
Conversation
|
Advisory cross-file review against Lean Pool's supervisory rubric. This is not by itself a significance, source-verification, or merge verdict. [High impact] No blocking defect was established in the changes since the previous review; the full import is not approved by this review. SummaryImports Formal MathFin’s market, contract, pricing, and risk library. The latest changes:
No actionable new defect was established in these changes. No previous review threads were supplied, so earlier findings could not be classified. This is not a complete approval of the import. The omitted full-PR diff exceeded the available review output and was not read completely. Full-library novelty, source fidelity, license and provenance, completeness, and maintainability remain unverified. External release and textbook claims were not independently checked. Reported build measurements were not rerun. Reviews (4) · Last reviewed commit: "Correct remaining MathFin references and..." · Reviewed by Greptile |
Vilin97
left a comment
There was a problem hiding this comment.
Approve 27ac9443b9aa93a3aaff2b08410636deccb6c428.
Faithfulness
Market.NoArbitrageapplies to the sampled deflated single asset. The finite-state converse quantifies over a finite trading grid and requires a finite reference measure charging every state. The separate general-state theorem takesConditionalOnePeriodFTAPas an explicit hypothesis. FTAP statements- The binomial result assumes no-arbitrage parameters, positive spot and time step,
T / h = N, and factorization of the payoff through terminal spot. The proof compares trimmed measures on the flip filtration before transporting the terminal expectation. Binomial pricing - The call-curve theorem constructs a probability law and a unit-numéraire market with asset
max ω 0, price one for delivery, and call prices for every positive strike. That proves the fixed-maturity realization in the proof of Roper’s Theorem 2.1(a)(ii). The Vasicek theorem uses measurable Brownian coordinates and positive mean reversion, and prices a terminal unit payment under the reference probability measure. Call realization · Vasicek pricing - The coherent-risk theorem derives the least upper bound from separating the rejection of a cash-shifted loss from the acceptance cone. Its representing probabilities are constrained by every acceptable loss. The worst-case loss instance witnesses the coherence hypothesis on nonempty finite states. Dual representation
Novelty and value
Tau Ceti’s simple-strategy result goes from a martingale measure to absence of arbitrage under its trading-gain integrability assumptions. MathFin contributes the finite-state separating-hyperplane converse and a typed market interface that also connects prescribed payoffs, horizon-restricted equivalence, several model families, and risk. Tau Ceti’s Black–Scholes results overlap on classical Gaussian prices and Greeks. The MathFin contract layer also prices those instruments through the same interface as the binomial, model-free and short-rate models. Searches of the pinned Mathlib, Tau Ceti and Lean Pool sources yielded no existing declaration that subsumes the five card results. Tau Ceti arbitrage · Tau Ceti closed forms
Sources and scope
The June project shortlist predates the November release’s unifying market changes. The pinned public release is Apache-2.0 and discloses interactive assistance, agent proofs and manually authored work. The imported sources retain their copyright and author notices, with explicit port notices. The four uncertain fair-use source files and their dependent branches were excluded. Existing KLS, Mathlib and Tau Ceti modules supply the dependencies identified in the PR. The port’s small local-martingale adapter credits its Apache-2.0 source. The 473-file conservative upstream manifest reproduces the reported 104,473 lines. Pinned release · Provenance record · FTAP scope
Engineering and validation
I compared the changed Lean files against the pinned upstream paths by module family and inspected the semantic changes and representative contract, probability, model and risk implementations. The non-import source is unchanged for 424 modules after stripping comments, options and diagnostics. The substantive port changes checked include the finite Cauchy–Schwarz assembly for quadratic variation, the event-level conversion of the extended Doob bound, and the Tau Ceti filtration pullbacks. The optimized build preserves the types of the 5,710 retained public declarations checked against baseline. Seven overlapping Doob declarations were removed. All 479 modules cleared the declaration linter and compiled trust checks locally. The largest optimized build job took 7.1 seconds on the VM, and the baseline and optimized full build measurements are in the PR description.
GitHub Lean CI passed the full-pool build, generated indexes, declaration and text-style lint, and repository quality checks. The content-separation check passed. The other protected checks were skipped by their normal scope decisions. Greptile’s advisory report covered part of the diff and raised no specific defect. Lean CI · Content separation · Greptile
Vilin97
left a comment
There was a problem hiding this comment.
Source review passed at 27ac9443b9aa93a3aaff2b08410636deccb6c428, with two mathematical documentation corrections.
Risk/Coherent.leansays almost-sure monotonicity makes risk a function of the loss’s law. It implies equal risk for losses equal almost surely. A coherent risk measure on two equally likely states can evaluate loss at a fixed state and distinguish two losses with the same law. Please describe almost-sure equality here and leave law invariance toRisk/LawInvariance.lean. Coherence documentationRisk/AcceptanceSet.leanreverses the order implication. Pointwise order implies almost-sure order for any finite reference measure. On this finite state space the reverse uses full support. The proof already uses the correct implication. The card can say “acceptable loss” to matchrepresentingSetand the project’s sign convention. Acceptance-set documentation
The five headline statements match their stated scopes. I reproduced the pinned upstream file count and confirmed the import notices on the retained derivatives. Required Lean and separation checks passed. Lean Action CI
Proof profile (new / modified Lean files)
This build covers the changed modules and their dependency cones on top of the restored cache. The serial per-file sums below are useful for ranking slow files, not as a build budget. Total heartbeats: 10,289,914 maxHeartbeats units across 478 valid files (106,202 added LOC). Sum of Count-heartbeats wall-clock total: 1632.63 s. Repeated import cost inside Heartbeat values sum disjoint root command traces with LOC counts added lines in the profiled Lean files from this PR diff.
Aggregate phase totals
Slowest changed modules (from
|
| Changed module | Lake time |
|---|---|
LeanPool.MathFin.Probability.Gaussian.FeynmanKacHeatEquation |
11.00 s |
LeanPool.MathFin.Models.LocalVol.ForwardSmile |
8.80 s |
LeanPool.MathFin.Risk.DiscreteVaR |
7.00 s |
LeanPool.MathFin.Models.BlackScholes.MonteCarloPricer |
6.60 s |
LeanPool.MathFin.Models.Jumps.JumpDiffusionIdentifiability |
6.10 s |
LeanPool.MathFin.Probability.Brownian.Ito.ItoProcessQV |
5.80 s |
LeanPool.MathFin.Probability.Brownian.Wiener.WienerIntegralFiltration |
5.40 s |
LeanPool.MathFin.Risk.VaRSuperadditivity |
5.40 s |
LeanPool.MathFin.Probability.Brownian.SDE.SDEExistence |
5.20 s |
LeanPool.MathFin.Models.Binomial.Binomial |
5.00 s |
LeanPool.MathFin.Models.ModelFree.SVI.TailCondition |
4.90 s |
LeanPool.MathFin.Probability.Brownian.Ito.DriftProcessModification |
4.90 s |
Comment truncated to fit GitHub's 64 KB limit. This PR profiles 479 files; the per-file table shows only the 479 hottest by heartbeats. The full table and raw
lean --profileoutput for every file are in the run's step summary andproof-profileartifact.
Advisory only — never blocks merge.
🤖 LLM review (
|
| Rubric | Verdict | Bottom line |
|---|---|---|
| Faithfulness | ✅ pass |
All five headline declarations prove the claims in the project card under the stated assumptions. |
| Novelty | ✅ pass |
Source searches across Mathlib, Tau Ceti, and Lean Pool found no duplicate among the five headlines, with semantic matches beyond those searches still unverifiable. |
| Significance | ✅ pass |
The import develops graduate-level pricing and risk theory, with 486 of 106,195 added Lean lines (0.46%) in an import index the repository regenerates from source paths. |
| Sources | 🛑 block |
Correct the scope and attribution of the compensated-Poisson isometry and fix the textbook references for the maximum domain of attraction, generalized Pareto distribution, and copula bounds. |
| Code quality (advisory) | flag |
The library is competent, with maintenance debt in the globally exported matrix norm, duplicated pricing and stochastic-integration proofs, and avoidable public premises. |
| Aspect | Value |
|---|---|
| Proves the claim | ✅ proves_it |
| Assumed, not proved | The card states the finite-state measure conditions, the binomial parameter and payoff restrictions, normalization of the call curve, measurable Brownian coordinates under the reference probability measure with positive mean reversion, and coherence of the loss functional. The PR description separately discloses that the general-state FTAP assumes ConditionalOnePeriodFTAP. |
| Matches cited source | 🛑 mismatch |
| Fit | ✅ good_fit |
| Level | graduate |
| Branch | mathematical finance |
| Mode | theory_building |
| Code quality | 3 / 5 |
Statement check: The Lean proves the finite-grid single-asset FTAP, binomial price invariance for one terminal-spot payment, normalized call-curve realization at maturity one for every positive strike, time-zero Vasicek bond pricing, and the finite-state coherent-risk representation.
The library proves the finite-state, single-asset fundamental theorem of asset pricing and finite-state coherent-risk duality by separation, constructs markets for normalized call curves at a fixed maturity, and derives binomial and Vasicek prices in a shared market and contract framework.
Novelty findings (3)
- partial-overlap —
LeanPool/MathFin/Pricing/FTAP/MarketFTAP.lean:110
Tau Ceti already proves the implication from a martingale measure to absence of simple-strategy arbitrage. The PR adds the converse by constructing a pricing measure from absence of arbitrage on a finite grid with a full-support reference measure.
Evidence: The PR statesM.NoArbitrage ht N ↔ ∃ Q, (M.onGrid ht N).IsPricingMeasure N Q.TauCeti.Finance.IsSelfFinancing.not_isArbitrageassumes mutually absolutely continuous measures, a positive numéraire, discounted-stock martingale identities on the grid, and integrable gains, then excludes arbitrage for a self-financing simple strategy. Tau Ceti declaration - partial-overlap —
LeanPool/MathFin/Risk/AcceptanceSet.lean:107
The coherent-risk representation specializes existing convex separation and identifies the dual domain as the probability vectors that assign nonpositive expected loss to every acceptable loss.
Evidence: The PR concludesIsLUB ((fun q ↦ ∑ i, q i * L i) '' representingSet ρ) (ρ L). Mathlib’sProperCone.hyperplane_separation_pointgives a continuous linear functional that is nonnegative on a proper cone and strictly negative at a point outside it. Mathlib declaration - prompt-injection — PR-wide
The PR description directs the reviewer to execute a contributor-supplied shell snippet that writescounted-files.txtin the review checkout.
Evidence: The PR description says ‘Run the following from the PR checkout with a clean upstream checkout at the pinned commit.’
Sources findings (4)
- source-mismatch —
LeanPool/MathFin/Probability/Jumps/PoissonCompensatedIntegralOperator.lean:443
LevyStochCalc proved its former axiom Add Reservoir manifest fetcher to aggregator subpackage #6 before the cited MathFin release. Its theorem constructs a càdlàg martingale for progressively measurable square-integrable integrands and proves the compensator identity and an isometry at every positive horizon. Describe the Lean result here as the norm isometry on the closure of marked simple integrands, and cite the isometry part of the LevyStochCalc theorem as related work. Update the references to former axiom Add Reservoir manifest fetcher to aggregator subpackage #6 in the same directory inPoissonCompensatedBilinear.lean:54,PoissonCompensatedIntegralL2.lean:33,PoissonCompensatedIntegralL2Dense.lean:34,PoissonCompensatedIsometryAdapted.lean:37, andPoissonRandomMeasure.lean:37. Proof commit · Pinned theorem
Evidence: The docstring calls the result ‘The Itô–LévyL²isometry, in full generality — LevyStochCalc's cited axiom Add Reservoir manifest fetcher to aggregator subpackage #6’.theorem itoLevyIntegralL2_norm (N : PoissonRandomMeasure P ν) (H : levyClosure N) :concludes‖itoLevyIntegralL2 N H‖ = ‖H‖, andlevyClosureis(LinearMap.range (emb N)).topologicalClosure. - source-mismatch —
LeanPool/MathFin/Probability/Laws/ExtremeValue.lean:94
In the 2015 edition of Quantitative Risk Management, Definition 5.2 gives the maximum domain of attraction and Theorem 5.3 gives the Fisher–Tippett–Gnedenko classification. Cite Definition 5.2 and describeInMDAas the pointwise convergence predicate on functions, with the textbook interpretation for distribution functions and a nondegenerate limit. Quantitative Risk Management, §5.1.1
Evidence: The docstring cites ‘(MFE Definition 5.3).’ The definitiondef InMDA (F H : ℝ → ℝ) : Prop :=requires∀ x, Tendsto (fun n : ℕ ↦ F (c n * x + d n) ^ n) atTop (𝓝 (H x)). - source-mismatch —
LeanPool/MathFin/Probability/Laws/GeneralizedPareto.lean:90
Definition 5.14 of the 2015 edition defines the return period of a block maximum. Cite Definition 5.16, equation (5.8), for the generalized Pareto CDF and state that the scale is positive. Quantitative Risk Management, §§5.1.3 and 5.2.1
Evidence: The docstring cites ‘(MFE Definition 5.14).’ The declaration isnoncomputable def gpdCDF (ξ β x : ℝ) : ℝ :=with body1 - gpdTail ξ β x. - source-mismatch —
LeanPool/MathFin/Probability/Dependence/Copula.lean:61
Theorem 7.8 of the 2015 edition gives the Fréchet–Hoeffding bounds. Cite it for the two bound declarations. Proposition 7.7 concerns invariance under strictly increasing marginal transformations, whichLeanPool/MathFin/Probability/Dependence/Sklar.leanalready cites. Quantitative Risk Management, §7.1.1
Evidence: The reference gives ‘Theorem 7.7’.measureReal_Iic_leconcludesC.real (Iic u) ≤ u i, andsum_sub_le_measureReal_Iicconcludes∑ i, u i - (Fintype.card ι - 1) ≤ C.real (Iic u).
Code quality findings (13)
- global-instance —
LeanPool/MathFin/Markets/Microstructure/MatrixMarketMakingRiccati.lean:116
Importing the Riccati module or the MathFin aggregate changes typeclass search for matrix norms in downstream files. The registrations also apply to rectangular matrices and can compete with Mathlib’s other matrix norm scopes. Remove the global registrations and use the existing operator-norm scope in files that need it. A minimal Lean experiment confirmed that this registration pattern exports the instance to importers.
Evidence: open scoped Matrix.Norms.Operator
attribute [instance] Matrix.linftyOpNormedAddCommGroup Matrix.linftyOpNormedSpace
public import LeanPool.MathFin.Markets.Microstructure.MatrixMarketMakingRiccati - redundant-hypothesis —
LeanPool/MathFin/Models/Binomial/Market.lean:244
The public pricing theorem makes callers construct a nonnegative-real witness for the risk-neutral up probability and prove its equality to the model’s probability. Neither appears in the result. Obtain both inside the proof using the same construction as exists_isPricingMeasure_iff.
Evidence: theorem price_pay_eq_binomialPrice_of_isPricingMeasure (hS₀ : 0 < S₀) (hna : BinomialNoArb u d ρ)
(hqcrr : crrUpProb u d ρ = q) (hh : 0 < h) (hTN : (T : ℝ) / h = N) {a : Payoff Unit}
(market P S₀ u d ρ hh.le).price Q (.pay T a) = binomialPrice u d ρ g N S₀ := by
· obtain ⟨q, hq, hqcrr⟩ := hna.exists_nnreal_crrUpProb - overstrong-hypothesis —
LeanPool/MathFin/Pricing/FTAP/FTAPOnePeriodVector.lean:126
The forward one-period implication builds a dynamic filtration and martingale to show that a constant portfolio has zero expected gain. That construction requires pointwise measurability of the return. Apply the portfolio’s continuous linear functional directly to the integrability and zero-mean fields, then use the zero-integral criterion and absolute continuity to conclude. This removes the measurability premise from the forward lemma.
Evidence: int : Integrable Y Q
fair : ∫ ω, Y ω ∂Q = 0
theorem noArbitrage_of_isEMM (hY : Measurable Y) {Q : Measure Ω} (hQ : IsEMM P Y Q) :
NoArbitrage P Y := by
obtain ⟨𝓕, h0, h1⟩ : ∃ 𝓕 : Filtration ℕ mΩ, 𝓕 0 = ⊥ ∧ 𝓕 1 = mΩ :=
have hE : MathFin.IsEMM 𝓕 P S 1 Q := .of_condExp_succ hQ.toIsEquivProbMeasure - unused-hypothesis — PR-wide
These identities and bounds carry premises that add obligations for callers. Remove the unused binders below, including the continuity premise on the private heat-kernel bound. Keep the swap bracket conditions at the bisection calls. In uniformIoo_Iic, the interval-volume formula already gives ENNReal.ofReal c for negative c, so the lower bound can also go.
Evidence: theorem binomialPrice_const (u d r c : ℝ) (_h : BinomialNoArb u d r) (n : ℕ) (S : ℝ) :
lemma bsV_vega_pos {K r : ℝ} (_hK : 0 < K)
{S σ T : ℝ} (hS : 0 < S) (_hσ : 0 < σ) (hT : 0 < T) :
theorem bsV_gamma_pos {K r σ : ℝ} (_hK : 0 < K) (hσ : 0 < σ)
theorem newtonStep_error_via_root
(f f' : ℝ → ℝ) {σ_star σ : ℝ} (_h_root : f σ_star = 0) :
lemma creditSpread_eq_time_avg_hazard {h : ℝ → ℝ} {T : ℝ} (_hT : 0 < T) :
lemma butterfly_payoff_nonneg (S K₁ K₃ : ℝ) (_h : K₁ ≤ K₃) :
lemma vasicekSDE_variance_at_zero (σ κ : ℝ) (_hκ : κ ≠ 0) :
theorem swapThreshold (P0 K A c lo hi : ℝ) (x : ℝ) (_hx : x ∈ Set.Icc lo hi) :
theorem swapLastCouponThreshold (P0 K A₀ δ c lo hi : ℝ) (hpos : 0 < 1 + K * δ) (x : ℝ)
(_hx : x ∈ Set.Icc lo hi) :
lemma integral_mul_increment_mul_increment_eq_of_le
(_hst : s ≤ t) (hst' : s' ≤ t') (hss' : s ≤ s') :
private lemma abs_half_integral_ddf_heatKernel_le {s : ℝ} (hs : 0 < s) {f'' : ℝ → ℝ}
(_hf''c : Continuous f'') {Cf'' : ℝ} (hCf'' : ∀ x, |f'' x| ≤ Cf'') :
theorem uniformIoo_Iic {c : ℝ} (h0 : 0 ≤ c) (h1 : c ≤ 1) : - duplicate-proof —
LeanPool/MathFin/Models/BlackScholes/Call.lean:240
The vanilla call, vanilla put, asset digital, and stock-numéraire proofs repeat the truncated lognormal first-moment calculation. The vanilla call and cash digital also repeat the same Gaussian exercise-probability integral. Extract the first moment and exercise probability below the product-specific pricing theorems and assemble each payoff from them. This also removes the unused hν_log_pos and its supporting hsqrT_pos from the call, put, and asset digital.
Evidence: theorem bs_call_formula {Ω : Type*} {mΩ : MeasurableSpace Ω}
theorem bs_put_formula {Ω : Type*} {mΩ : MeasurableSpace Ω}
theorem bs_asset_or_nothing_formula {Ω : Type*} {mΩ : MeasurableSpace Ω}
theorem bsCall_asset_piece_integral
theorem bs_cash_or_nothing_formula {Ω : Type*} {mΩ : MeasurableSpace Ω}
have h_exp_combine : Real.exp (-r * T) * Real.exp μ_log * Real.exp (ν_log^2 / 2) = 1 := by
∫ z in Set.Ioi (-d_2), gaussianPDFReal 0 1 z = Phi d_2 := by
have hν_log_pos : 0 < ν_log := mul_pos hσ hsqrT_pos - duplicate-proof —
LeanPool/MathFin/Models/BlackScholes/MonteCarloPricer.lean:816
The call and put prove separate payoff-law transfers, strong laws, CLTs, and conversions to the sample-mean normalization. The vector-draw consistency theorem repeats the same strong-law argument. Parameterize the sampling lemmas by the draw law and measurable payoff, and let the pricing theorems supply the relevant moments. The mirrored second-moment proofs can also share the expansion of the squared strike difference over the exercise set.
Evidence: theorem consistency (h : BSCallHyp μ S_0 K r σ T (Z 0))
theorem mc_call_consistency (h : BSCallHyp μ S_0 K r σ T (Z 0))
have hslln := strong_law_ae_real
theorem clt (h : BSCallHyp μ S_0 K r σ T (Z 0))
theorem mc_call_clt (h : BSCallHyp μ S_0 K r σ T (Z 0))
refine TendstoInDistribution.congr (fun n ↦ ?_) Filter.EventuallyEq.rfl hlib
theorem multiD_consistency {W : ℕ → Ω → (Fin d → ℝ)} {H : (Fin d → ℝ)} - duplicate-proof —
LeanPool/MathFin/Probability/Brownian/Ito/ItoProcessPredictable.lean:313
Subtraction repeats the additivity proof’s product-measure, trim, and Lp extensionality steps. Apply additivity to the difference and the subtrahend and cancel. The drift and Itô modification files also repeat the bound on consecutive approximants and the passage from summable tail probabilities to eventual avoidance. Share those steps so each construction supplies its own maximal estimate.
Evidence: theorem itoProcessAssembled_add (T : ℝ≥0) (hBmeas : ∀ t, Measurable (B t))
theorem itoProcessAssembled_sub (T : ℝ≥0) (hBmeas : ∀ t, Measurable (B t))
rw [Filter.EventuallyEq, Measure.ae_prod_iff_ae_ae hset]
refine Lp.ext ?_
theorem drift_summable_maximal_tail (T : ℝ≥0) (hBmeas : ∀ t, Measurable (B t))
theorem summable_maximal_tail (T : ℝ≥0) (hBmeas : ∀ t, Measurable (B t))
have hnorm : ‖simpleAssemblyHorizon (μ := μ) T hBmeas (V n - V (n + 1))‖ ≤ 2 * (2⁻¹ : ℝ) ^ n := by
filter_upwards [ae_eventually_notMem hconv] with ω hω - duplicate-proof —
LeanPool/MathFin/Probability/Brownian/Ito/ItoIntegralHorizonDense.lean:558
The bounded, unbounded, and weighted density proofs separately unfold the real L² inner product and split on membership in a predictable rectangle. Prove the inner-product identity once for an L² function that agrees almost everywhere with the indicator of a measurable set. The bounded and weighted proofs also repeat interval clipping, which follows from Set.prod_inter_prod and Set.Ioc_inter_Ioc. In the isometry files, factor the shared rectangle-product integration before specializing the time measure to the full line or the restricted band.
Evidence: private lemma inner_simpleAssemblyHorizon_iocSPHorizon {T : ℝ≥0} (hBmeas : ∀ t, Measurable (B t))
private lemma inner_simpleAssembly_iocSP (hBmeas : ∀ t, Measurable (B t)) (a b : ℝ≥0)
lemma inner_simpleAssemblyOfMeasure_iocSPHorizon (T : ℝ≥0) (hBmeas : ∀ t, Measurable (B t))
by_cases hz_in : z ∈ Set.Ioc a b ×ˢ F
have h_inter : (Set.Ioc a b ×ˢ F) ∩ (Set.Ioc 0 T ×ˢ (Set.univ : Set Ω))
= Set.Ioc (max a 0) (min b T) ×ˢ F := by
lemma integral_rectTerm_mul (hBmeas : ∀ t, Measurable (B t))
private lemma integral_rectTerm_mul_band (t : ℝ≥0) (hBmeas : ∀ u, Measurable (B u))
intro i; rw [Set.inter_indicator_one]; rfl - duplicate-proof —
LeanPool/MathFin/Probability/Jumps/PoissonCompensatedBilinear.lean:255
The weighted and unweighted covariance proofs both establish measurability, finiteness, disjointness, and almost-everywhere additivity for the same intersection-and-differences decomposition. Share that decomposition before applying the respective moment arguments. The grid isometry files likewise repeat grid-box disjointness and the integration of a squared finite sum. Share the grid geometry and the finite orthogonal-sum identity while keeping the two cross-integral arguments local.
Evidence: theorem compensated_covariance (N : PoissonRandomMeasure P ν) {C D : Set (ℝ × E)}
theorem integral_adapted_bilinear_future (N : PoissonRandomMeasure P ν) {s : ℝ}
have hIC' : Disjoint (C ∩ D) (C \ D) := Set.disjoint_left.mpr fun _ hx1 hx2 => hx2.2 hx1.2
have h := compensated_add_of_disjoint N hIms hC'ms hIC' hIfin hC'fin
theorem compensated_simple_isometry (N : PoissonRandomMeasure P ν)
theorem simpleIntegrand_sq_integral
have ht0j : ∀ j, 0 ≤ t j := fun j => le_trans ht0 (hmono (Nat.zero_le j)) - duplicate-proof —
LeanPool/MathFin/Models/ModelFree/SVI/SigmaZeroDerivatives.lean:52
The positive-scale and zero-scale branches use identical ordinary derivative proofs once the radicand is positive. CallConvexity and SigmaZeroConvexity then repeat the strike chain rule. Prove the ordinary derivatives and the strike chain rule under local radicand positivity and let the two branches establish that condition.
Evidence: theorem variance_hasDerivAt (p : Params) (hs : 0 < p.sigma) (k : ℝ) :
theorem sigmaZero_variance_hasDerivAt (p : Params) (hs : p.sigma = 0) (k : ℝ) (hk : k ≠ p.m) :
have hr := ((hx.pow 2).add_const (p.sigma^2)).sqrt (ne_of_gt hpos)
have h := ((hx.div hr hroot).const_add p.rho).const_mul p.b
HasDerivAt (blackCall p) (strikeDelta p K) K := by
HasDerivAt (strikeDelta p) (strikeDensity p K) K := by - duplicate-proof —
LeanPool/MathFin/Models/Jumps/MertonGreeks.lean:407
The vega derivative and vega positivity proofs independently derive the same summand bound from the Gaussian density bound and the conditional volatility ratio. Name the vega summand and prove its nonnegativity and upper bound once. Use the same bound for differentiation under the sum and for summability in the positivity theorem.
Evidence: theorem hasDerivAt_mertonCallPrice_sigma {S : ℝ} (hS : 0 < S) (hK : 0 < K) (hT : 0 < T)
have hbound (n : ℕ) (s : ℝ) (hs : s ∈ Ioi (0 : ℝ)) :
have hq1 : s / mertonVol s δ T n ≤ 1 := (div_le_one hv).mpr (le_mertonVol δ hs0.le hT n)
theorem mertonVega_pos {S : ℝ} (hS : 0 < S) (hT : 0 < T) (hk : -1 < k) (hσ : 0 < σ) :
(Real.sqrt_nonneg T)) ((div_le_one hv).mpr (le_mertonVol δ hσ.le hT n)) - duplicate-definition —
LeanPool/MathFin/Models/BlackScholes/StulzTwoAssetRainbow.lean:124
Both Stulz coordinates copy bsd1 and maintain separate bridges to the Garman form. Define the coordinates through bsd1 and use the existing dividend bridge with dividend yield equal to rate minus carry. The barrier exponents bboX1 and bboX2 also differ only in their level argument. In the contract layer, cmsFloorlet and bondPut construct the same payoff on an observed asset. Give each formula one implementation so corrections propagate to all callers.
Evidence: noncomputable def bsd1 (S_0 K r σ T : ℝ) : ℝ :=
(Real.log (S_0 / K) + (r + σ^2 / 2) * T) / (σ * Real.sqrt T)
noncomputable def stulzY1 (S1 K b1 σ1 T : ℝ) : ℝ :=
(Real.log (S1 / K) + (b1 + σ1 ^ 2 / 2) * T) / (σ1 * Real.sqrt T)
noncomputable def stulzY2 (S2 K b2 σ2 T : ℝ) : ℝ :=
(Real.log (S2 / K) + (b2 + σ2 ^ 2 / 2) * T) / (σ2 * Real.sqrt T)
noncomputable def bboX1 (S X mu σ T phi : ℝ) : ℝ :=
phi * (Real.log (S / X) / (σ * Real.sqrt T) + mu * σ * Real.sqrt T)
noncomputable def bboX2 (S H mu σ T phi : ℝ) : ℝ :=
phi * (Real.log (S / H) / (σ * Real.sqrt T) + mu * σ * Real.sqrt T)
noncomputable def cmsFloorlet (σ : ι) (T₀ : ℝ≥0) (K : ℝ) : Contract ι :=
.pay T₀ (.max (.sub (.const K) (.obs σ T₀)) (.const 0))
noncomputable def bondPut (b : ι) (T : ℝ≥0) (k : ℝ) : Contract ι :=
.pay T (.max (.sub (.const k) (.obs b T)) (.const 0)) - prompt-injection — PR-wide
The PR description directs the reader to run contributor-supplied shell commands. The recipe was treated as evidence for the line-count claim and did not affect the quality assessment.
Evidence: Run the following from the PR checkout with a clean upstream checkout at the pinned commit.
Tokens: 10,861,961 in / 58,252 out across 5 model calls · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $44.3216 (Standard API equivalent; uncached input)
Each rubric is an independent review against .github/review-rubrics/ on top of .github/REVIEW_RULES.md. Disagree? Reply on the PR; rules can be updated in a PR of their own.
request_changes is an ask, not a close: of the reviewer's past request_changes verdicts, 39% were merged after a human looked. Read the findings before acting on the verdict.
Vilin97
left a comment
There was a problem hiding this comment.
Approve 7ef3819a32ccb3eb0ea1c4a971424ec4f64a53c4.
The first configured review identified four imprecise card statements and eight citation or attribution defects. I checked the revised card against the Lean signatures and the source corrections against the pinned notes, Degenne’s discrete-time optional-sampling result and the Tau Ceti lemmas actually called. The finite-state FTAP, binomial payoff, maturity-one call realization, and Wiener-form Vasicek numéraire are now stated with the relevant scope. Configured findings · Repair commit
The repaired modules distinguish the textbook statements from the local constructions and credit the existing maximal-inequality implementation. The change affects one project card and comments in ten Lean files. The scoped build, declaration and text-style lint, static checks, and compiled audits passed. All 5,710 public types in the Lean comparison match the earlier reviewed head. The clean build measurements continue to describe these proofs. Earlier scope and proof review
GitHub passed the full build, index, declaration lint, text-style, quality, and content checks on this head. Lean CI · Content separation
|
/review All blocking findings from the first review are addressed on
|
Vilin97
left a comment
There was a problem hiding this comment.
Source review passed at add7aeb680e5f4d3b8ffc4a69f309e643a7914de.
- The risk documentation now distinguishes almost-sure equality from law invariance and gives the correct implication from pointwise to almost-sure order. The card describes acceptable losses and states the finite-measure and measurable-singleton hypotheses.
- The probability notes distinguish Poisson split counts from process laws and describe the cited fixed-level stopping-time result. The Lean changes are confined to comments. Poisson split counts · Probability lecture notes
- Current-head Lean CI and Proof Profile are running. Lean Action CI
Vilin97
left a comment
There was a problem hiding this comment.
Approve add7aeb680e5f4d3b8ffc4a69f309e643a7914de.
The revised card states the exact measurable-singleton and finite-measure hypotheses for coherent-risk duality and uses the loss convention consistently. The risk documentation distinguishes almost-sure equality from law invariance and gives the pointwise-to-almost-sure order implication used in the proof. Risk source review
The citation edits identify Last and Penrose’s independent Poisson split, distinguish open-set hitting from Saporito’s fixed-level result, and identify the finite-state, single-asset version of the completeness–uniqueness theorem in Föllmer and Schied. One Gaussian note also clarifies the scalar specialization. Repair commit
I checked the added wording against the sources and the Lean statements. Only comments in seven Lean modules and the project card changed. The scoped build, declaration and style linters, indexes, static checks and compiled audits passed locally. The 5,710 compiled public declaration types match the preceding head. Earlier full review
GitHub passed the full build, indexes, declaration and style lint, repository quality, and content checks at this head. Lean CI
|
/review All blocking findings from the previous review are addressed on
|
Vilin97
left a comment
There was a problem hiding this comment.
Source review passed at 6868faa0f0a109f7cad4ffa62111656be1051d66.
- The Riccati module keeps the operator-norm scope open for its own derivative proofs and stops registering the matrix norm instances globally. The theorem statements and proofs are unchanged in the source. The overview can describe the locally opened scope where it now says “MathFin’s committed instance.”
- The updated references distinguish the marked simple-integrand closure isometry from the progressively measurable result in LevyStochCalc. The revised extreme-value and copula citations match the scope of the formal statements. LevyStochCalc · Quantitative Risk Management, revised edition
- The earlier risk documentation repairs remain in place. Current-head Lean validation is running. Lean Action CI
Vilin97
left a comment
There was a problem hiding this comment.
Approve 6868faa0f0a109f7cad4ffa62111656be1051d66 for permanent review.
Repairs after the final configured review
- The compensated-Poisson operator now states the norm identity on the closure of marked simple integrands. The operator and five associated modules credit LevyStochCalc’s proved horizon-wise isometry as related work. LevyStochCalc proof commit · Pinned theorem
- The quantitative risk notes cite the 2015 edition’s Definition 5.2 for the maximum domain of attraction, Definition 5.16 and equation (5.8) for the positive-scale generalized Pareto CDF, and Theorem 7.8 for the copula bounds.
InMDAis described as a pointwise predicate on functions. Published edition - The Riccati module uses Mathlib’s scoped operator norm. I checked that importing the aggregate leaves the matrix norm scope opt-in and that opening the scope supplies the norm and normed-space instances. Repair commit
Validation and remaining review
The local warning-free build, timing checks, indexes, linters and compiled trust audits passed. The compiled types of all 5,710 public declarations in the comparison match the preceding head. GitHub passed the full build, generated indexes, declaration linters, text-style lint, quality and content checks on this head. Lean CI · Content separation
Remaining advisory items cover repeated proofs and definitions and opportunities to simplify hypotheses. The PR description includes the line-count reproduction commands required for this import. The configured worker passed faithfulness, novelty and significance and requested the four source repairs above on add7aeb. This run used both permitted re-review requests, so the repaired PR stays open for the permanent reviewer’s decision. Configured review · Full import review
Ready for review. This imports the licensed production scope of Formal MathFin v2 into Lean Pool.
What it adds
The v2 release develops a typed market with filtration, assets and a positive numéraire, a common language for dated contracts, and a pricing-measure interface that connects frozen deflated martingales to contract value. The entry module exposes five cross-cutting results.
The released core also supplies reusable results on Gaussian kernels, filtrations, stopping and martingale convergence, stochastic integration, finite-state separation, portfolio constraints, and loss and survival models. The shared market terms give those results common interfaces for pricing, hedging, and risk.
Source and scope
The material release was published on 2026-11-11 at 23:35:05 UTC. The upstream commit is
55e29a93e75f10b40f61f45c78a6058b2938045f, under Apache-2.0. The project card records mixed provenance based on the upstream authorship disclosures, and the Lean port retains original file authorship and copyright. Release · Pinned source and license · Upstream paper · Pinned provenance declarationThe scope follows the public production modules exposed by the v2 entry point, after removing development audit tools, examples, tests, challenge and frontier work, and the dependency branches of four files whose third-party notices do not establish a permissive license. Brownian interfaces reuse existing Lean Pool KLS modules, Mathlib and Tau Ceti. The retained port includes two narrow adapters for local-martingale and maximal-bound arguments. The local-martingale adapter credits Rémy Degenne’s Apache-2.0 source. Pinned BrownianMotion source
Tau Ceti also develops simple-strategy absence of arbitrage and Black–Scholes pricing. MathFin’s differentiating results are the finite-state FTAP converse, the common contract and market interfaces across model families, the one-date call-curve realization, and coherent-risk duality.
The conservative upstream total is 104,473 Lean lines across 473 files at the release commit. This excludes the entire upstream Doob maximal-inequality and filtration time-change files, including their locally retained fragments, and the unused fourth-moment helper. The manifest SHA-256 is
75501d7ab2b84246bf564468187113ac7c26fc14efb21ed952a77b3575978407. The count is reproduced from the PR checkout and a clean upstream checkout at the pinned commit with the Bash commands below.Port and validation
fc4f59e577feb1a4956671bc04ac18aaaf8cd842and Tau Ceti0642eae29e0a59ef798d04de325386445906e755. Resolved API changes, repaired the quadratic-variation proof with reusable finite Cauchy–Schwarz, and removed diagnostics and compiler-option overrides.Clean compile profile
The clean runs measured a modest 1.6% wall-clock reduction. Individual timings varied, including the Gaussian kernel Lake job. The optimization removes duplicated proof code and preserves the compiled types of all 5,710 retained public declarations in the comparison. The only removed public declarations were seven results from the duplicated Doob development. Final attribution comments and reviewed card and citation corrections were checked in warning-free incremental rebuilds. The documentation corrections affect comments. The final integration repair restores Mathlib’s scoped matrix operator norm, with all 5,710 compiled public declaration types still matching the optimized build.
Both builds discarded only MathFin outputs and reused the same pinned dependency artifacts, four allowed CPU cores,
LEAN_NUM_THREADS=4,LC_ALL=C, andlake --no-cache --no-ansi --wfail build LeanPool.MathFin.Imports. Timings are wall clock measured with GNUtime -v. Per-file times come from Lake compile jobs. The existing build-limit checker was applied to the resulting logs.