Are My Invariants Valid? A Learning Approach

03/14/2019
by   Vincent J. Hellendoorn, et al.
0

Ensuring that a program operates correctly is a difficult task in large, complex systems. Enshrining invariants -- desired properties of correct execution -- in code or comments can support maintainability and help sustain correctness. Tools that can automatically infer and recommend invariants can thus be very beneficial. However, current invariant-suggesting tools, such as Daikon, suffer from high rates of false positives, in part because they only leverage traced program values from available test cases, rather than directly exploiting knowledge of the source code per se. We propose a machine-learning approach to judging the validity of invariants, specifically of method pre- and post-conditions, based directly on a method's source code. We introduce a new, scalable approach to creating labeled invariants: using programs with large test-suites, we generate Daikon invariants using traces from subsets of these test-suites, and then label these as valid/invalid by cross-validating them with held-out tests. This process induces a large set of labels that provide a form of noisy supervision, which is then used to train a deep neural model, based on gated graph neural networks. Our model learns to map the lexical, syntactic, and semantic structure of a given method's body into a probability that a candidate pre- or post-condition on that method's body is correct and is able to accurately label invariants based on the noisy signal, even in cross-project settings. Most importantly, it performs well on a hand-curated dataset of invariants.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
03/28/2019

A Counterexample-guided Approach to Finding Numerical Invariants

Numerical invariants, e.g., relationships among numerical variables in a...
research
11/18/2019

Invariant Diffs

Software development is inherently incremental. Nowadays, many software ...
research
01/03/2023

Invalidator: Automated Patch Correctness Assessment via Semantic and Syntactic Reasoning

In this paper, we propose a novel technique, namely INVALIDATOR, to auto...
research
06/27/2019

Invariant Detection with Program Verification Tools

Compilers can specialize programs having invariants for performance impr...
research
12/11/2020

WITCHER : Detecting Crash Consistency Bugs in Non-volatile Memory Programs

The advent of non-volatile main memory (NVM) enables the development of ...
research
04/30/2019

Targeted Synthesis for Programming with Data Invariants

Programmers frequently maintain implicit data invariants, which are rela...
research
02/26/2019

Iteratively Composing Statically Verified Traits

Metaprogramming is often used to programmatically generate faster specia...

Please sign up or login with your details

Forgot password? Click here to reset