120 research outputs found
Modular Construction of Shape-Numeric Analyzers
The aim of static analysis is to infer invariants about programs that are
precise enough to establish semantic properties, such as the absence of
run-time errors. Broadly speaking, there are two major branches of static
analysis for imperative programs. Pointer and shape analyses focus on inferring
properties of pointers, dynamically-allocated memory, and recursive data
structures, while numeric analyses seek to derive invariants on numeric values.
Although simultaneous inference of shape-numeric invariants is often needed,
this case is especially challenging and is not particularly well explored.
Notably, simultaneous shape-numeric inference raises complex issues in the
design of the static analyzer itself.
In this paper, we study the construction of such shape-numeric, static
analyzers. We set up an abstract interpretation framework that allows us to
reason about simultaneous shape-numeric properties by combining shape and
numeric abstractions into a modular, expressive abstract domain. Such a modular
structure is highly desirable to make its formalization and implementation
easier to do and get correct. To achieve this, we choose a concrete semantics
that can be abstracted step-by-step, while preserving a high level of
expressiveness. The structure of abstract operations (i.e., transfer, join, and
comparison) follows the structure of this semantics. The advantage of this
construction is to divide the analyzer in modules and functors that implement
abstractions of distinct features.Comment: In Proceedings Festschrift for Dave Schmidt, arXiv:1309.455
Synthesizing Short-Circuiting Validation of Data Structure Invariants
This paper presents incremental verification-validation, a novel approach for
checking rich data structure invariants expressed as separation logic
assertions. Incremental verification-validation combines static verification of
separation properties with efficient, short-circuiting dynamic validation of
arbitrarily rich data constraints. A data structure invariant checker is an
inductive predicate in separation logic with an executable interpretation; a
short-circuiting checker is an invariant checker that stops checking whenever
it detects at run time that an assertion for some sub-structure has been fully
proven statically. At a high level, our approach does two things: it statically
proves the separation properties of data structure invariants using a static
shape analysis in a standard way but then leverages this proof in a novel
manner to synthesize short-circuiting dynamic validation of the data
properties. As a consequence, we enable dynamic validation to make up for
imprecision in sound static analysis while simultaneously leveraging the static
verification to make the remaining dynamic validation efficient. We show
empirically that short-circuiting can yield asymptotic improvements in dynamic
validation, with low overhead over no validation, even in cases where static
verification is incomplete
A Categorical Framework for Program Semantics and Semantic Abstraction
Categorical semantics of type theories are often characterized as
structure-preserving functors. This is because in category theory both the
syntax and the domain of interpretation are uniformly treated as structured
categories, so that we can express interpretations as structure-preserving
functors between them. This mathematical characterization of semantics makes it
convenient to manipulate and to reason about relationships between
interpretations. Motivated by this success of functorial semantics, we address
the question of finding a functorial analogue in abstract interpretation, a
general framework for comparing semantics, so that we can bring similar
benefits of functorial semantics to semantic abstractions used in abstract
interpretation. Major differences concern the notion of interpretation that is
being considered. Indeed, conventional semantics are value-based whereas
abstract interpretation typically deals with more complex properties. In this
paper, we propose a functorial approach to abstract interpretation and study
associated fundamental concepts therein. In our approach, interpretations are
expressed as oplax functors in the category of posets, and abstraction
relations between interpretations are expressed as lax natural transformations
representing concretizations. We present examples of these formal concepts from
monadic semantics of programming languages and discuss soundness.Comment: MFPS 202
On Correctness of Automatic Differentiation for Non-Differentiable Functions
Differentiation lies at the core of many machine-learning algorithms, and is
well-supported by popular autodiff systems, such as TensorFlow and PyTorch.
Originally, these systems have been developed to compute derivatives of
differentiable functions, but in practice, they are commonly applied to
functions with non-differentiabilities. For instance, neural networks using
ReLU define non-differentiable functions in general, but the gradients of
losses involving those functions are computed using autodiff systems in
practice. This status quo raises a natural question: are autodiff systems
correct in any formal sense when they are applied to such non-differentiable
functions? In this paper, we provide a positive answer to this question. Using
counterexamples, we first point out flaws in often-used informal arguments,
such as: non-differentiabilities arising in deep learning do not cause any
issues because they form a measure-zero set. We then investigate a class of
functions, called PAP functions, that includes nearly all (possibly
non-differentiable) functions in deep learning nowadays. For these PAP
functions, we propose a new type of derivatives, called intensional
derivatives, and prove that these derivatives always exist and coincide with
standard derivatives for almost all inputs. We also show that these intensional
derivatives are what most autodiff systems compute or try to compute
essentially. In this way, we formally establish the correctness of autodiff
systems applied to non-differentiable functions
An array content static analysis based on non-contiguous partitions
International audienceConventional array partitioning analyses split arrays into contiguous partitions to infer properties of sets of cells. Such analyses cannot group together non contiguous cells, even when they have similar properties. In this paper, we propose an abstract domain which utilizes semantic properties to split array cells into groups. Cells with similar properties will be packed into groups and abstracted together. Additionally, groups are not necessarily contiguous. This abstract domain allows to infer complex array invariants in a fully automatic way. Experiments on examples from the Minix 1.1 memory management and a tiny industrial operating system demonstrate the effectiveness of the analysis
An Abstract Domain to Infer Types over Zones in Spreadsheets
International audienceSpreadsheet languages are very commonly used, by large user bases, yet they are error prone. However, many semantic issues and errors could be avoided by enforcing a stricter type discipline. As declaring and specifying type information would represent a prohibitive amount of work for users, we propose an abstract interpretation based static analysis for spreadsheet programs that infers type constraints over zones of spreadsheets, viewed as two-dimensional arrays. Our abstract domain consists in a cardinal power from a numerical abstraction describing zones in a spreadsheet to an abstraction of cell values, including type properties. We formalize this abstract domain and its operators (transfer functions, join, widening and reduction) as well as a static analysis for a simplified spreadsheet language. Last, we propose a representation for abstract values and present an implementation of our analysis
Hierarchical Shape Abstraction of Dynamic Structures in Static Blocks
International audienceWe propose a hierarchical shape abstract domain, so as to infer structural invariants of dynamic structures such as lists living inside static structures, such as arrays. This programming pattern is often used in safety critical embedded software that need to ''allocate'' dynamic structures inside static regions due to dynamic memory allocation being forbidden in this context. Our abstract domain precisely describes such hierarchies of structures. It combines several instances of simple shape abstract domains, dedicated to the representation of elementary shape properties, and also embeds a numerical abstract domain. This modular construction greatly simplifies the design and the implementation of the abstract domain. We provide an implementation, and show the effectiveness of our approach on a problem taken from a real code
Revisiting Recency Abstraction for JavaScript Towards an Intuitive, Compositional, and Efficient Heap Abstraction
International audienceJavaScript is one of the most widely used programming languages. To understand the behaviors of JavaScript programs and to detect possible errors in them, researchers have developed several static analyzers based on the abstract interpretation framework. However, JavaScript provides various language features that are difficult to analyze statically and precisely such as dynamic addition and removal of object properties, first-class property names, and higher-order functions. To alleviate the problem, JavaScript static analyzers often use recency abstraction, which refines address abstraction by distinguishing recent objects from summaries of old objects. We observed that while recency abstraction enables more precise analysis results by allowing strong updates on recent objects, it is not monotone in the sense that it does not preserve the precision relationship between the underlying address abstraction techniques: for an address abstraction A and a more precise abstraction B, recency abstraction on B may not be more precise than recency abstraction on A. Such an unintuitive semantics of recency abstraction makes its composition with various analysis sensitivity techniques also unintuitive. In this paper, we propose a new sin-gleton abstraction technique, which distinguishes singleton objects to allow strong updates on them without changing a given address abstraction. We formally define recency and singleton abstractions, and explain the unintuitive behaviors of recency abstraction. Our preliminary experiments show promising results for singleton abstraction
Automatic Verification of Embedded System Code Manipulating Dynamic Structures Stored in Contiguous Regions
International audienceUser-space programs rely on memory allocation primitives when they need to construct dynamic structures such as lists or trees. However, low-level OS kernel services and embedded device drivers typically avoid resorting to an external memory allocator in such cases, and store structure elements in contiguous arrays instead. This programming pattern leads to very complex code, based on data-structures that can be viewed and accessed either as arrays or as chained dynamic structures. The code correctness then depends on intricate invariants mixing both aspects. We propose a static analysis that is able to verify such programs. It relies on the combination of abstractions of the allocator array and of the dynamic structures built inside it. This approach allows to integrate program reasoning steps inherent in the array and in the chained structure into a single abstract interpretation. We report on the successful verification of several embedded OS kernel services and drivers
- …