Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Soundness of a fuel-bounded checked constraint solver

Proved
NishtAbel2024.checked_solver_sound

by kmehltretter82 · Nov 2, 2026 · Mathlib 0df444a (Lean v4.33.1)

sized-typesterminationtype-theory

Let Ψ\PsiΨ be a size context, CCC a finite list of size constraints, TTT a finite list of tracked variables, and n∈Nn\in\mathbb Nn∈N a fuel bound. Write Sn(Ψ,C,T)S_n(\Psi,C,T)Sn​(Ψ,C,T) for the checked wrapper around the existing constraint solver. For every flexible substitution φ\varphiφ,

Sn(Ψ,C,T)=some⁡(φ)⟹Coherent⁡(Ψ,C,φ).S_n(\Psi,C,T)=\operatorname{some}(\varphi) \quad\Longrightarrow\quad \operatorname{Coherent}(\Psi,C,\varphi).Sn​(Ψ,C,T)=some(φ)⟹Coherent(Ψ,C,φ).

Coherence means that the substitution fixes every rigid variable, maps every variable to a well-formed size expression in Ψ\PsiΨ, and satisfies every constraint using the current formalization's normalization of right-hand bounds. This gives a sound acceptance criterion for the candidate computed by the existing solver.

The wrapper is incomplete: returning no candidate can reflect insufficient fuel or an incomplete comparison search and does not imply unsatisfiability. The theorem does not certify separate raw function-call bounds, establish completeness or correctness of the original Algorithm 1, or prove termination of a program.

Formalization Note. This is an auxiliary construction for the current Lean model, not the thesis's full Theorem 14.

Preamble
import Definitions.Def_NishtAbel2024_CheckedConstraintSolver
Formal statement
namespace NishtAbel2024

theorem checked_solver_sound :
    ∀ (fuel : Nat) (Ψ : SizeCtx) (C : List SizeConstraint) (T : List SizeVar) (φ : FlexSubst),
      CheckedConstraintSolver.checkedSolve fuel Ψ C T = some φ → CoherentSubst Ψ C φ := by
  sorry

end NishtAbel2024
Source
Auxiliary certificate for the existing Lean solver, inspired by K. Nisht, Type-Based Termination Checking in Agda (2024), §6.4, pp. 56–58, https://knisht.github.io/agda/msc.pdf. The checked wrapper and this conditional result are not the thesis’s full Theorem 14 or its original algorithm.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me