Definition
A machine-code proof boundary is the declared edge of what a proof about compiled machine code covers. It lists the exact code bytes analyzed, the entry points and the state assumed at entry, the instructions whose meaning the proof models, the memory regions involved, the exits, and the contracts assumed for everything outside: called functions, interrupt handlers §6.12 and other hardware. Inside the boundary the proved property holds. For an execution that leaves the boundary, the proof says nothing.
The idea
A tool checks that a function never writes outside a 16-byte buffer. It models arithmetic, loads and stores, and proves each store in bounds, until it meets an instruction it has no model for, or a call into a library it has not analyzed. If the tool simply steps over that instruction or call as if it did nothing, it has quietly chosen one behavior among many. The call might have changed the register that holds the buffer’s address, or freed the buffer. The tool would then report the function safe while one of its executions writes outside the buffer.
A proof is a chain of steps, each relying on the facts that earlier steps established. A gap in the chain does not weaken the conclusion a little; it removes the support for everything after the gap. A surveyed map is a fair picture: inside its border every road has been measured, and outside the border the map shows nothing. The proof boundary is that border. The picture stops at contracts. A proof can extend past its own border by relying on a stated contract for the region outside, much as a traveler can rely on someone else’s survey, and then the conclusion depends on that contract being true.
How it works
A proof about machine code fixes six things, and its boundary is wherever one of them runs out.
The code: the exact bytes, identified for example by a cryptographic hash §5.1, and the address at which they are loaded. A proof about a different build, even one compiled from the same source, does not transfer.
Decoding: where each instruction starts and ends. In Arm’s Thumb instruction set §4.40, instructions are 2 or 4 bytes long, and decoding from a wrong starting offset produces different instructions. Constants that the compiler places among the instructions must not be decoded as code. The control-flow graph §3.13, the map of which instruction can follow which, must include every target of every indirect branch.
Entry state: what is assumed when execution enters. This covers the values of live-in registers §4.44, the registers that the code reads before it writes them; the stack pointer and the free stack space below it; the condition flags §4.42; and which memory the code may use.
Instruction semantics: for each instruction, a model of its effect on registers, flags and memory, taken from the processor’s architecture manual. The supported instructions are exactly those that have a model.
Environment contracts: for each call to code outside the proof, which registers it preserves, which memory it may read, write or free, and whether and where it returns; for interrupt handlers and other hardware, which shared memory they may change, and when.
Exits: the points where the proof’s claim is checked, such as returns, calls out and faults.
At an instruction without a model, or a call without a contract, a tool that keeps its soundness §3.7, the guarantee that it never proves a false claim, has three choices:
overapproximate: assume the instruction or call may do anything it is able to do, for example that every register a called function need not preserve now holds an unknown value and every memory location it can reach may have changed, and continue with those weaker facts;
refuse: stop and report the property as unsupported for every path through that point, which is conservative refusal §3.36;
narrow: prove a conditional statement, if the call meets a stated contract then the property holds, and carry the condition into the result.
Treating the unknown step as doing nothing is not one of the choices. The result has three outcomes that must stay distinct: proved, violated (a path that breaks the property was found) and unknown (the proof reached its boundary).
Worked example
A slice of Thumb code starts with register R3 holding 0x20000400, the address of a live 16-byte buffer, and runs two instructions:
BL helper, a call to a function outside the proof;STR R0, [R3, #12], a 4-byte store at the address in R3 plus 12.
Without the call, the store is in bounds: it writes bytes 12 to 15 of the buffer, and . A store at offset 13 would fail the same test, since .
With the call, the arithmetic is still true, but it is no longer about the store. Arm’s procedure call standard lets a called function overwrite R0 to R3 and R12, so after the call R3 may hold any value. A tool that overapproximates marks R3 unknown, cannot bound the store’s address, and reports unknown. A tool that steps over the call as if it did nothing reports the store safe, and is wrong whenever helper leaves a different value in R3.
A compiler would normally keep the pointer in R4, which the procedure call standard requires a called function to preserve. That contract restores the address fact: after the call, R4 still holds 0x20000400. It does not restore the lifetime fact. If helper could free the buffer, the store is a use-after-free §4.6 even though its address is in range. The proof becomes complete only with a second contract: helper neither frees nor writes the buffer. The result is then conditional on both contracts, and it stays conditional until helper itself is proved to meet them.
Stated precisely
Let be the premise that the bytes executed are the bytes analyzed, loaded at the analyzed address; the entry precondition, the assumptions about registers and memory at a declared entry; the premise that every instruction executed is one the proof models, with the modeled meaning; the premise that every external call, interrupt handler and other hardware writer meets its stated contract; and the property proved. The proof establishes where means and, and means implies.
In the notation of a Hoare triple §3.31, which states that if a precondition holds before a piece of code runs and the code finishes, then a postcondition holds afterwards, the proof is the triple , valid only under , and . The boundary is the set of paths covered together with these four premises. A path that reaches an unmodeled instruction or a call without a contract lies outside the boundary unless an overapproximation §19.2.5 covers it, and is not established for that path. Passing every other check does not supply a missing premise.
Limits and common mistakes
A proof covers only its property. A proof that every store stays in bounds says nothing about timing, about secrets leaking through timing, or about whether the function computes the right answer.
Undefined is not unsupported. An instruction encoding §2.7 that the architecture defines as undefined has a defined consequence, a fault (on Cortex-M, a UsageFault), and a proof can model it. Unsupported means only that the tool lacks a model; the instruction may do anything the hardware allows. The Undefined versus unsupported semantics §3.35 entry treats this distinction.
A disassembler’s listing is evidence about decoding, not proof. It can misplace function boundaries, decode embedded constants as instructions, and miss the targets of indirect branches.
Refusal and overapproximation have a cost: they report some safe programs as unknown. That cost is the price of never reporting an unsafe program as safe.
A test run does not supply the missing step. One execution in which the call happened to preserve R3 shows one behavior, not all of them.
A proof about source code does not transfer to the machine code, because the compiler may reorder, inline or delete code. Translation validation §3.33, checking each compiled output against its source, is one way to connect the two.
Questions answered
What happens at the first unsupported instruction or external call?
At the first unsupported instruction or external call, the proof stops establishing anything for the execution paths that pass through that point, unless the tool does one of three sound things. It can model every effect the instruction or call could have and continue with weaker facts: for a call, every register the called function may overwrite becomes unknown, and every memory location it can reach may have changed. It can stop and report the property as unsupported for those paths. Or it can prove a conditional result: it states the contract the instruction or call must meet, such as which registers it preserves and which memory it may write or free, and carries that condition into the conclusion.
What the tool must not do is step over the instruction or call as if it did nothing and report the whole function proved. The outcome at that point must also be reported as unknown, distinct from both proved and violated: reaching the boundary of a proof is evidence neither that the code is wrong nor that it is right.
Related entries: Undefined versus unsupported semantics (§3.35), Conservative refusal (§3.36), Live-in register (§4.44), Load-store forwarding analysis (§4.46), Soundness (§3.7), Hoare triple (§3.31), Translation validation (§3.33), Overapproximation versus underapproximation (§19.2.5).