← Latest papers
💻 computer science

Array-Carrying Symbolic Execution for Function Contract Generation

This paper presents a novel symbolic execution framework implemented within LLVM and integrated with Frama-C that generates function contracts by effectively carrying invariants and modification information over contiguous array segments, thereby overcoming limitations of existing approaches in analyzing array-manipulating functions.

Original authors: Weijie Lu, Jingyu Ke, Hongfei Fu, Zhouyue Sun, Yi Zhou, Guoqiang Li, Haokun Li

Published 2026-03-02
📖 4 min read☕ Coffee break read

Original authors: Weijie Lu, Jingyu Ke, Hongfei Fu, Zhouyue Sun, Yi Zhou, Guoqiang Li, Haokun Li

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a quality inspector in a massive, automated factory. Your job is to write a "User Manual" (a contract) for every machine (function) that passes through your line. This manual needs to tell you:

  1. What you need to feed the machine (Preconditions).
  2. What the machine will spit out (Postconditions).
  3. What parts of the factory floor the machine is allowed to touch or change (Assigns).

The problem? Many of these machines are array-manipulating monsters. They don't just handle one item at a time; they grab huge, continuous rows of boxes (arrays) and rearrange them, search through them, or add numbers across them.

Existing inspectors (old tools) were like blindfolded workers. They could guess the rules for a single box, but when a machine grabbed a whole row of 1,000 boxes, they got confused. They couldn't tell you exactly which boxes changed or what the relationship was between the first box and the last one. They either gave up or wrote vague, useless manuals.

The New Solution: The "Carrying" Inspector

The authors of this paper built a new kind of inspector called Array-Carrying Symbolic Execution. Here is how it works, using simple analogies:

1. The "Carrying" Backpack

Imagine your inspector has a magical backpack. As the machine runs, the inspector doesn't just watch; they carry a running log of the state of the entire row of boxes.

  • Old Way: The inspector looked at one box, wrote down a note, looked at the next, and forgot the first.
  • New Way: The inspector carries a "segment" in their backpack. They know, "Okay, from box 0 to box 50, every single box is now even numbers." They carry this knowledge forward as the machine moves.

2. Handling the "Split Paths" (The Fork in the Road)

Sometimes, a machine has a "If/Else" decision.

  • Scenario: "If you find a zero, stop. If not, keep going."
  • Old Way: The inspector would try to merge these two paths into one messy, vague rule, often losing the specific details.
  • New Way: The inspector splits into two parallel universes. In Universe A (found a zero), they carry the note: "Boxes 0 to 10 are zeros, and we stopped here." In Universe B (didn't find a zero), they carry: "Boxes 0 to 100 are zeros, and we reached the end."
  • The Magic: At the end, instead of forcing a messy merge, the inspector writes a contract that says: "The result is EITHER Universe A's rule OR Universe B's rule." This keeps the information precise.

3. The "Merging" Puzzle

Imagine a machine that processes a row of boxes in two stages:

  1. First, it processes the first 100 boxes in big batches.
  2. Then, it processes the remaining 50 boxes one by one.
  • Old Way: The inspector might say, "It touched the first 100" and "It touched the last 50," but fail to realize these are actually one continuous block from 0 to 150.
  • New Way: The inspector sees the two separate notes in their backpack. They realize, "Hey, these two segments are right next to each other!" They merge them into a single, clean note: "The machine modified the entire row from 0 to 150."

Why This Matters

In the real world, software libraries (like the ones used for encryption or handling certificates) rely heavily on these "rows of boxes" (arrays). If you can't write a precise contract for them, you can't prove the software is safe.

  • The Result: The authors tested their new inspector on 282 different programs.
  • The Competition: A top-tier existing tool (AutoDeduct) managed to write a perfect, verifiable manual for only 10 programs.
  • The New Tool: Their "Carrying" inspector wrote perfect manuals for 68 programs, including complex cryptographic code that the old tools couldn't even touch.

The Catch (Limitations)

The new inspector is great at handling rows of boxes (arrays). However, it's still learning how to handle twisted chains (linked lists) or complex trees (binary trees). If the data structure is a simple, straight line, the inspector is a genius. If the data structure is a tangled knot of pointers, the inspector gets a bit confused.

Summary

Think of this paper as inventing a super-powered magnifying glass that doesn't just look at individual pixels on a screen, but understands the entire picture as a continuous, moving image. It allows computers to automatically write precise, trustworthy manuals for complex software that handles large amounts of data, ensuring that when we use these programs, we know exactly what they did and what they changed.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →