Skip to main content
QUICK REVIEW

[Paper Review] Learning Invariants using Decision Trees

Siddharth Krishna, Christian Puhrsch|arXiv (Cornell University)|Jan 20, 2015
Adversarial Robustness in Machine LearningComputer Science33 references23 citations
TL;DR

This paper proposes a decision tree-based algorithm to learn inductive invariants as Boolean combinations of numerical inequalities from test data, enabling efficient and scalable invariant inference for C programs. The method achieves high precision and scalability, outperforming existing ML-based techniques on challenging benchmarks by learning complex invariants directly from large sample sets without manual template tuning.

ABSTRACT

The problem of inferring an inductive invariant for verifying program safety can be formulated in terms of binary classification. This is a standard problem in machine learning: given a sample of good and bad points, one is asked to find a classifier that generalizes from the sample and separates the two sets. Here, the good points are the reachable states of the program, and the bad points are those that reach a safety property violation. Thus, a learned classifier is a candidate invariant. In this paper, we propose a new algorithm that uses decision trees to learn candidate invariants in the form of arbitrary Boolean combinations of numerical inequalities. We have used our algorithm to verify C programs taken from the literature. The algorithm is able to infer safe invariants for a range of challenging benchmarks and compares favorably to other ML-based invariant inference techniques. In particular, it scales well to large sample sets.

Motivation & Objective

  • To address the challenge of automatically inferring inductive invariants for program safety verification in large or complex programs.
  • To improve scalability and precision in invariant inference by leveraging machine learning on test-generated data.
  • To enable the automatic discovery of complex invariants with arbitrary Boolean structures, including unions of polyhedra.
  • To provide a probabilistic completeness guarantee for invariant learning under the PAC model.
  • To reduce reliance on manual template engineering by learning invariant structure and thresholds directly from data.

Proposed method

  • The algorithm represents program states as points in a d-dimensional space of integer variables.
  • It uses features based on hyperplane slopes of the form ±xi ± xj, inspired by the octagon abstract domain, to define numerical inequalities.
  • A decision tree learner is applied to classify reachable (good) and unsafe (bad) states from test samples, producing a Boolean combination of inequalities as a candidate invariant.
  • The decision tree structure naturally captures complex invariants through hierarchical splits based on feature thresholds.
  • The method provides a theoretical bound on sample size for probabilistic completeness under the PAC learning framework.
  • The algorithm avoids manual template specification by learning both Boolean structure and threshold values from data, enabling generalization to nonlinear features.

Experimental results

Research questions

  • RQ1Can decision trees effectively learn complex inductive invariants as Boolean combinations of numerical inequalities from test data?
  • RQ2How does the scalability of decision tree-based invariant learning compare to existing ML-based approaches on large sample sets?
  • RQ3What is the impact of feature design—specifically, using octagon-style slopes—on the expressiveness and accuracy of inferred invariants?
  • RQ4Can the algorithm achieve high precision without requiring a refinement loop, given sufficient test data?
  • RQ5How does the method's theoretical completeness guarantee compare to other learning-based invariant inference techniques?

Key findings

  • The algorithm successfully infers safe invariants for a range of challenging C program benchmarks that are difficult for other tools.
  • It scales well to large sample sets, with a time complexity of O(mn log n), outperforming set-cover-based methods with O(mn³) complexity.
  • Decision tree learning produces simpler invariants than MCMC and ICE-based approaches, due to its greedy, hierarchical structure that prefers simpler models.
  • The method achieves better performance than [14] and [30] in both running time and expressiveness, without requiring fixed templates or bounded thresholds.
  • The algorithm does not require a refinement loop in practice, as sufficient sampling leads to correct invariants directly, unlike ICE-learning frameworks that rely on counterexample-guided refinement.
  • The theoretical probabilistic completeness guarantee ensures that with a sufficiently large sample, the algorithm learns a safe invariant with high probability under the PAC model.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.