Claim #7 — Verification of <str as heck::ToTrainCase>::to_train_case (with creusot 0.14.0)
<str as heck::ToTrainCase>::to_train_case
Tool: creusot 0.14.0
Preconditions
true
Creusot specification
#[ensures(
crate::case_spec::converted(self@, 5u8, result@)
)]
fn to_train_case(&self) -> Self::OwnedEvidence
What is trusted
From the report
The contracts assume that string iteration yields exactly the input's scalar sequence in order and that scalar case iterators yield the complete ordered mappings and terminate, with the stated bounds on mapping lengths. The Unicode predicates and scalar mappings are modeled as opaque functions assumed to match the corresponding Rust standard-library operations. Collection of a finite Vec<char> iterator into a String is assumed to terminate; its output content is checked against the standard models. Vector and string operations rely on those models and on successful, representable allocation; resource exhaustion is outside the termination and output guarantee. The proof also relies on Creusot's translation, verification conditions and the underlying proof tools.
Technical limitations
From the report
The verified bodies are a runtime adaptation of the release. The release's owned methods format their Display wrappers; the adaptation prepares scalar classifications and case expansions, then builds the result directly. This makes the segmentation and mapping pipeline accessible to the verifier. The original Display implementations and their formatting, write errors and partial output are not verified by these contracts. The adaptation changes allocation and execution behavior. Formal equivalence to the unchanged release, including resource failures, remains open.
Finite native comparisons between release and adapted implementations provide evidence of correspondence; they do not establish equivalence for all inputs. The standard-library Unicode models are assumptions rather than a proof of the underlying Unicode tables. Alias delegation and the behavior of third-party implementations are outside this report's selected owned-method contracts.