2023/10/03 by Elizabeth Dinella, Shuvendu K. Lahiri, Dinella, Elizabeth +3
Computer Science · Mathematics · #Bytecode #Causal inference #Causation #Computer science #Correctness #Debugging #FOS: Computer and information sciences #Generator (circuit theory) #Java #Java bytecode #Mathematics #Modulo #Precondition #Predicate transformer semantics #Program comprehension #Program slicing #Programming Languages (cs.PL) #Programming language #Readability #Scale (ratio) #Semantics (computer science) #Software #Software Engineering (cs.SE) #Software Engineering Research #Software Reliability and Analysis Research #Software Testing and Debugging Techniques #Software system #Theoretical computer science
paper · pdf · doi:10.48550/arxiv.2310.02154
openalex publication_date 2023/10/03 · openalex created_date 2025/10/10 · openalex updated_date 2026/07/28
We introduce a novel approach for inferring natural preconditions from code. Our technique produces preconditions of high quality in terms of both correctness (modulo a test generator) and naturalness. Prior works generate preconditions from scratch through combinations of boolean predicates, but fall short in readability and ease of comprehension. Our innovation lies in, instead, leveraging the structure of a target method as a seed to infer a precondition through program transformations. Our evaluation shows that humans can more easily reason over preconditions inferred using our approach. Lastly, we instantiate our technique into a framework which can be applied at scale. We present a dataset of ~18k Java (method, precondition) pairs obtained by applying our framework to 87 real-world projects. We use this dataset to both evaluate our approach and draw useful insights for future research in precondition inference.