Field Testing Stainless by Verifying Daisy’s AST Library

Automation is rapidly transforming industries, shifting responsibility from human workers to machines. However, since machines lack sentience, ensuring correctness falls on developers. Formal methods offer a rigorous approach to provide strong correctness guarantees, but their adoption remains limited due to usability challenges such as steep learning curves and language limitations. We focus on a subset of formal methods: deductive verifiers. These mitigate usability challenges by automating large portions of the verification process. This work uses a deductive verifier for Scala: Stainless. We verify the abstract syntax tree (AST) package of a library used in practice: Daisy, a mature static analyser that optimises and verifies finite-precision code. Our methodology breaks down the verification process using informal package specifications. We then derive formal specifications for functions and algebraic datatypes from these informal guidelines and verify that the implementation adheres to the formal specifications. We increase the amount of verified code used in practice and contribute insights from the process to tool developers and users. In particular, some of the results we present are: (1) A verification of Daisy's optimisations over ASTs (e.g., that $0 + lhs \to lhs$ preserves semantics); (2) Limitations in Stainless that contribute to the code bloat of 3:1 between specifications and functionality; (3) Synergies between our modular methodology and Stainless's annotations.

Publication Details

Journal
KTH Publication Database DiVA (KTH Royal Institute of Technology)
Published
2025-01-01
Primary Topic
Logic, programming, and type systems
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Field Testing Stainless by Verifying Daisy’s AST Library

KTH Publication Database DiVA (KTH Royal Institute of Technology)
Logic, programming, and type systems
article

Field Testing Stainless by Verifying Daisy’s AST Library

article en

Abstract

Automation is rapidly transforming industries, shifting responsibility from human workers to machines. However, since machines lack sentience, ensuring correctness falls on developers. Formal methods offer a rigorous approach to provide strong correctness guarantees, but their adoption remains limited due to usability challenges such as steep learning curves and language limitations. We focus on a subset of formal methods: deductive verifiers. These mitigate usability challenges by automating large portions of the verification process. This work uses a deductive verifier for Scala: Stainless. We verify the abstract syntax tree (AST) package of a library used in practice: Daisy, a mature static analyser that optimises and verifies finite-precision code. Our methodology breaks down the verification process using informal package specifications. We then derive formal specifications for functions and algebraic datatypes from these informal guidelines and verify that the implementation adheres to the formal specifications. We increase the amount of verified code used in practice and contribute insights from the process to tool developers and users. In particular, some of the results we present are: (1) A verification of Daisy's optimisations over ASTs (e.g., that $0 + lhs \to lhs$ preserves semantics); (2) Limitations in Stainless that contribute to the code bloat of 3:1 between specifications and functionality; (3) Synergies between our modular methodology and Stainless's annotations.

KTH Publication Database DiVA (KTH Royal Institute of Technology)
Decent work and economic growth
Openalex Percentile: Top 72%
Logic, programming, and type systems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Field Testing Stainless by Verifying Daisy’s AST Library · KTH Publication Database DiVA (KTH Royal Institute of Technology) (2025) | TGRS Research Map | TGRS