UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

108 lines (107 loc) 8.96 kB
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id'; type Interval = [number, number]; /** The bottom element (least element) of the positive interval domain representing no possible values, explicitly given as "bottom". */ export declare const IntervalBottom = "bottom"; /** The top element (greatest element) of the positive interval domain representing all possible values, defined as the interval from 0 to infinity. */ export declare const IntervalTop: [0, number]; /** The positive interval domain representing possible integer values. */ export type IntervalDomain = Interval | typeof IntervalBottom; /** The bottom element (least element) of the column names domain representing no possible column name, defined as the empty list []. */ export declare const ColNamesBottom: []; /** The top element (greatest element) of the column names domain representing all possible values, explicitly given as "top". */ export declare const ColNamesTop = "top"; /** The column names domain defined as bounded string set domain representing possible column names. */ export type ColNamesDomain = string[] | typeof ColNamesTop; /** * The data frame shape domain representing possible data frame shapes, defined as product domain of * the {@link ColNamesDomain} for the columns names and {@link IntervalDomain} for the number of columns and rows. * */ export interface DataFrameDomain { colnames: ColNamesDomain; cols: IntervalDomain; rows: IntervalDomain; } /** * The bottom element (least element) of the data frame shape domain representing no possible value, mapping the columns names to {@link ColNamesBottom} * and the number of columns and rows to {@link IntervalBottom}. */ export declare const DataFrameBottom: { readonly colnames: []; readonly cols: "bottom"; readonly rows: "bottom"; }; /** * The top element (greatest element) of the data frame shape domain representing all possible value, mapping the columns names to {@link ColNamesTop} * and the number of columns and rows to {@link IntervalTop}. */ export declare const DataFrameTop: { readonly colnames: "top"; readonly cols: [0, number]; readonly rows: [0, number]; }; /** * The data frame shape state domain representing possible memory states, mapping AST node IDs to data frame shape values of the {@link DataFrameDomain}. */ export type DataFrameStateDomain = Map<NodeId, DataFrameDomain>; /** Checks if two abstract values of the column names domain are equal. */ export declare function equalColNames(set1: ColNamesDomain, set2: ColNamesDomain): boolean; /** Checks if two abstract values of the column names domain are ordered according to the partial ordering of the column names lattice. */ export declare function leqColNames(set1: ColNamesDomain, set2: ColNamesDomain): boolean; /** Joins two abstract values of the columns names domain according to the column names lattice by creating the least upper bound (LUB). */ export declare function joinColNames(set1: ColNamesDomain, set2: ColNamesDomain, maxColNames?: number): ColNamesDomain; /** Meets two abstract values of the columns names domain according to the column names lattice by creating the greatest lower bound (GLB). */ export declare function meetColNames(set1: ColNamesDomain, set2: ColNamesDomain): ColNamesDomain; /** Subtracts an abstract value from another abstract value of the column names domain by performing a set minus. */ export declare function subtractColNames(set1: ColNamesDomain, set2: ColNamesDomain): ColNamesDomain; /** * Widens two abstract values of the column names domain via naive widening to soundly over-approximate the join in (possibly infinite) fixpoint iterations. * * This is technically not necessary, as the join is limited by the maximum number of inferred column names. * However, this speeds up the iteration in larger loops significantly, as we are over-approximating the column names much earlier. */ export declare function wideningColNames(set1: ColNamesDomain, set2: ColNamesDomain): ColNamesDomain; /** Checks whether an abstract value of the column names domain satisfies a column name */ export declare function satisfiesColsNames(set: ColNamesDomain, value: string): boolean; /** Checks if two abstract values of the positive interval domain are equal. */ export declare function equalInterval(interval1: IntervalDomain, interval2: IntervalDomain): boolean; /** Checks if two abstract values of the positive interval domain are ordered according to the partial ordering of the positive interval lattice. */ export declare function leqInterval(interval1: IntervalDomain, interval2: IntervalDomain): boolean; /** Joins two abstract values of the positive interval domain according to the positive interval lattice by creating the least upper bound (LUB). */ export declare function joinInterval(interval1: IntervalDomain, interval2: IntervalDomain): IntervalDomain; /** Meets two abstract values of the positive interval domain according to the positive interval lattice by creating the greatest lower bound (GLB). */ export declare function meetInterval(interval1: IntervalDomain, interval2: IntervalDomain): IntervalDomain; /** Adds two abstract values of the positive interval domain, by adding the lower bounds and upper bounds. */ export declare function addInterval(interval1: IntervalDomain, interval2: IntervalDomain): IntervalDomain; /** Subtracts an abstract value from another abstract values of the positive interval domain, by subtracting the lower bounds and upper bounds. */ export declare function subtractInterval(interval1: IntervalDomain, interval2: IntervalDomain): IntervalDomain; /** Creates the minium of two abstract values of the positive interval domain, by creating the minimum of the lower bounds and upper bounds. */ export declare function minInterval(interval1: IntervalDomain, interval2: IntervalDomain): IntervalDomain; /** Creates the maximum of two abstract values of the positive interval domain, by creating the maximum of the lower bounds and upper bounds. */ export declare function maxInterval(interval1: IntervalDomain, interval2: IntervalDomain): IntervalDomain; /** Extrends the lower bound of an abstract value of the positive interval domain to 0. */ export declare function extendIntervalToZero(interval: IntervalDomain): IntervalDomain; /** Extrends the upper bound of an abstract value of the positive interval domain to infinity. */ export declare function extendIntervalToInfinity(interval: IntervalDomain): IntervalDomain; /** Widens two abstract values of the positive interval domain via naive widening to soundly over-approximate the join in (possibly infinite) fixpoint iterations. */ export declare function wideningInterval(interval1: IntervalDomain, interval2: IntervalDomain): IntervalDomain; /** Checks whether an abstract value of the positive interval domain satisfies a numeric value. */ export declare function satisfiesInterval(interval: IntervalDomain, value: number): boolean; /** Checks whether a numeric value satisfies the less-than relation with an abstract value of the positive interval domain. */ export declare function satisfiesLeqInterval(interval: IntervalDomain, value: number): boolean; /** Checks if two abstract values of the data frame shape domain are equal. */ export declare function equalDataFrameDomain(value1: DataFrameDomain, value2: DataFrameDomain): boolean; /** Joins multiple abstract values of the data frame shape domain by creating the least upper bound (LUB). */ export declare function joinDataFrames(...values: DataFrameDomain[]): DataFrameDomain; /** Meets multiple abstract values of the data frame shape domain by creating the greatest lower bound (GLB). */ export declare function meetDataFrames(...values: DataFrameDomain[]): DataFrameDomain; /** Widens two abstract values of the data frame shape domain by widening the column names and number of columns and rows. */ export declare function wideningDataFrames(value1: DataFrameDomain, value2: DataFrameDomain): DataFrameDomain; /** Checks if two abstract states of the data frame shape state domain are equal. */ export declare function equalDataFrameState(state1: DataFrameStateDomain, state2: DataFrameStateDomain): boolean; /** Joins multiple abstract states of the data frame shape state domain by joining each data frame shape of the states. */ export declare function joinDataFrameStates(...states: DataFrameStateDomain[]): DataFrameStateDomain; /** Meets multiple abstract states of the data frame shape state domain by meeting each data frame shape of the states. */ export declare function meetDataFrameStates(...states: DataFrameStateDomain[]): DataFrameStateDomain; /** Widens two abstract states of the data frame shape state domain by widening each data frame shape of the states. */ export declare function wideningDataFrameStates(state1: DataFrameStateDomain, state2: DataFrameStateDomain): DataFrameStateDomain; export {};