arXiv:2610.05316cs.PLOct 2026

Manuscript Offprint

arXiv:2610.05316

More Powerful Constant Value Checking with SMT Solving

Jonas Mittnacht, Florian Lanzinger

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

Jonas Mittnacht 1^{1}[0009-0005-4030-0125] and Florian Lanzinger 1^{1}[0000-0001-8560-6324]

Institute of Information Security and Dependability (KASTEL), Karlsruhe Institute of Technology, Karlsruhe, Germany

jonas.mittnacht@student.kit.edu

Abstract. Pluggable type systems extend the basic type system of a programming language by introducing additional type hierarchies to specify more complex properties and dependencies between variables. We consider the Constant Value Checker, a pluggable type checker for Java implemented using the Checker Framework, which provides various pluggable type systems and corresponding checkers. The Constant Value Checker lets users specify restrictions on the values a primitive integer or boolean variable can hold using a set or range of constant values. However, the current implementation of the Value Checker makes use of a limited set of syntactic typing rules that, in practice, often fail to verify well-typedness of more complex code.

In this paper, we introduce an extension to the Checker Framework using Satisfiability Modulo Theories (SMT) solvers to address these limitations by creating corresponding first-order logic formulas for expressions whose type checks fail with the current syntactic typing rules and determining their well-typedness based on the satisfiability of these formulas. Furthermore, we introduce new dependent types for specifying allowed values with expressions that can depend on other variables in the program.

Keywords: Checker Framework · Java · SMT · Pluggable Type Systems · Refinement Type Systems.

1 Introduction

Background Pluggable type systems are type systems defined on top of a language's base types and allow the specification of additional properties. To verify and strengthen guarantees about a Java program ahead of execution, the Checker Framework [2] project provides a set of such type systems and uses so-called Checkers to verify the correct usage of these types. One such pluggable type system in the Checker Framework is the Constant Value Checker [1]. It provides a set of annotations for denoting that the value of a variable of a primitive or String type (or the length of an array) is restricted to a set of constant values specified in the annotation. However, the type-checking capabilities of the underlying Checker implemented in the framework are rather limited in

J. Mittnacht et al.

power, particularly because it does not track correlations (e.g. equality) between variables. In expressions with strongly correlated variables, the Checker therefore often evaluates the resulting value to be within a much broader range than required - as an example, for an expression of the form (x+1)∗(x−1)(x + 1) * (x - 1) in which x is known to hold a value within the range [−2,2][-2, 2], the Constant Value Checker is unable to verify that the resulting value is indeed in the range [−1,3][-1, 3].

Contribution To alleviate these limitations, we present a method for validating constant value types using Satisfiability Modulo Theories (SMT) solving. We implemented this approach for the Checker Framework's value types in a fork 1^{1} of the framework and compared it to the existing Value Checker w.r.t. its performance and its expressiveness.

Related work Our work is related to more general refinement type systems. This term was introduced by Freeman and Pfenning [5] for a type system that refines algebraic data types by restricting the choice of constructor based on an expression's type. Nowadays, the term generally refers to type systems that combine a base type (e.g., int) with a refinement formula that must hold for all instances (e.g., −1≤x≤3-1 \leq x \leq 3). Most of these kinds of refinement type systems decide the well-typedness of a program by translating type constraints into formulas to be checked by an SMT solver or some other theorem prover [16,13,12,15,14,8,6].