Inferring static non-monotonically sized types through testing
نویسندگان
چکیده
We propose a size analysis algorithm that combines testing and type checking to automatically obtain static output-on-input size dependencies for first-order functions. Attention is restricted to functions for which the size of the result is strictly polynomial, not necessarily monotonic, in the sizes of the arguments. To infer a size dependency, the algorithm generates hypotheses for increasing degrees of polynomials. For each degree, a polynomial is defined by a finite number of points. The function is evaluated with a large enough set of appropriate measurement data to get these points and determine the coefficients of the polynomial. The resulting hypothesis is then checked using an existing type checking procedure. The algorithm is not tied to the current sized type checker. The sized type of a function will be inferred if it exists and if it is accepted by the sized type checker. For terminating functions, our sized type inference algorithm is complete with respect to type checking. Hence, using a more complete sized type checker yields a more complete sized type inference algorithm.
منابع مشابه
Inferring Static Non-monotone Size-aware Types Through Testing
We propose a size analysis procedure that combines testing and type checking to automatically obtain static output-on-input size dependencies for first-order functions. Attention is restricted to functions for which the size of the result is strictly polynomial, not necessarily monotonous, in the sizes of the arguments. To infer a size dependency, the procedure generates hypotheses for increasi...
متن کاملSlice-Hoisting for Array-Size Inference in MATLAB
Inferring variable types precisely is very important to be able to compile MATLAB libraries effectively in the context of the telescoping languages framework being developed at Rice. Past studies have demonstrated the value of type information in optimizing MATLAB [4]. The variable types are inferred through a static approach based on writing propositional constraints on program statements [11]...
متن کاملA Sized Time System for a Parallel Functional Language
This paper describes an inference system, whose purpose is to determine the cost of evaluating expressions in a strict purely functional language. Upper bounds can be derived for both computation cost and the size of data structures. We outline a static analysis based on this inference system for inferring size and cost information. The analysis is a synthesis of the sized types of Hughes et al...
متن کاملInferring Effective Types for Static Analysis of C Programs
The C language does not have a specific Boolean type: Boolean values are encoded with integers. This is also true for enumerated types, that may be freely and silently cast to and from integers. On the other hand, verification tools aiming at inferring the possible values of variables at each program point may benefit from the information that some (integer) variables are used solely as Boolean...
متن کاملApplying Static Analysis Techniques for Inferring Termination Conditions of Logic Programs
We present the implementation of cTI, a system for universal left-termination inference of logic programs, which heavily relies on static analysis techniques. Termination inference generalizes termination analysis/checking. Traditionally, a termination analyzer tries to prove that a given class of queries terminates. This class must be provided to the system, requiring user annotations. With te...
متن کامل